I'm trying to simply execute an ajax request to my server. The request passes my form data to signUp.php where the information is then process. Then php will echo back a responseText to my jqXHR object and I print the alert. The problem is that my php file is being executed, rather the jqXHR.responseText is instead returning the my php file itself as if it were a text file. A sample php responseTest would look like ...
"<?php
php code ...
?>"
Instead I want the responseText to return my echoes. The code is written bellow.
var formData = new FormData(document.getElementById("signUpForm"));
$.ajax({
url: "./cgi-script/signUp.php",
type: "POST",
xhr: function giveXmlHTTP(){
myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){
myXhr.upload.addEventListener('progress',progressHandler, false);
}
return myXhr;
},
success: function(data,statusText,jqXHR){
alert(jqXHR.responseText);
},
data:formData,
cache: false,
contentType: false,
processData: false
});
}