I'm using XAMPP as my server. I am able to make queries using PHP and I have tried other Ajax code and it does work but when I try posting to a different php file using ajax I keep getting the error returning 0 or null.
if (!e.isDefaultPrevented()) {
e.preventDefault();
$.ajax({
type: "POST",
url: "https://localhost/validate.php",
data: {'email': $('#email').val(), 'username': $('#username').val()},
dataType: "json",
success : function(text){
$('#signup_form').unbind('submit').submit();
},
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.
Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.
' + jqXHR.responseText);
}
}
});
}
This is my error "Not connect. Verify Network." I have tried passing the following urls and they all give me a 404 file not found error: validate.php, ../validate.php, localhost/validate.php, MusicApp/validate, localhost/MusicApp/validate, and etc. The only things that seem to work is https://localhost/MusicApp/validate.php, https://localhost:63342/localhost/MusicApp/validate.php but I keep getting the Not connect. Verify Network error.
I also can't do a post within a form without getting a 404 page not found error so I believe it might have something to do with the path?