I don't understand why this is returning the Error function from AJAX. I had it working a few days ago and I don't know how it's failing now. I even super simplified my code to try to fire the success and rebuild the rest.
This is my Jquery:
$("#results").click(function() {
$.ajax({
url: "http://www.URL.php",
type: "POST",
data: {
ajaxval: "A"
},
dataType: 'text',
success: function(data) {
alert(data);
alert("success");
},
error: function() {
alert("fail");
}
});
});
This is my PHP:
<!DOCTYPE html>
<html>
<body>
<?php
$ajaxnum = $_POST['ajaxval'];
echo $ajaxnum;
?>
</body>
</html>
Seems super simple, Please let me know if I'm somehow missing something. Like I said I had a much more complex php returning an html table by way of echoing rows back from a mySQL query result using a loop, etc.