I'm trying a really simple test just trying to get some AJAX working. So I've got a PHP file which just echos something if the POST variable 'test' is set.
When I run the script, it alerts the errors but there's no error message just "error" and then the next alert is blank.
How can I get this working?
PHP
if (isset($_POST['test'])){
echo "Some data";
}
AJAX:
url = "http://***/test.php";
$.ajax({
url: url,
data: { test: "test" },
type: "POST",
crossDomain: true,
dataType: 'html',
success: function (data) {
alert ("Successful");
alert (data);
},
error: function (xhr, err) {
alert (err);
alert(xhr.responseText);
}
});