Here below is my code using ajax call to send data to PHP.
function ajax(action) {
serialData = $("#frm_"+action).serializeArray();
// alert(JSON.stringify(data));
// data = new FormData($("#frm_"+action));
//append files
alert(JSON.stringify(data));
var file = document.getElementById('Image').files[0];
if (file) {
serialData.append('upload-image', file);
}
$.ajax({
type: "POST",
url: "data_upload.php",
data: serialData,
processData: false,
contentType: false,
dataType: "json",
success: function(response) {
}
Above is my code I am Trying to send data to ajax with this code without appending file able to send data to the PHP but with file appending getting the error like Illegal Action and append is not a function. If anyone know about this Please suggest me
Comments
Post a Comment