I have a jQuery ajax call with the following code:
var dataString = 'title=' + title;
alert ('datastring: ' + dataString); // This reports the correct value
$.ajax({
type: 'POST',
url: 'script.php',
data: dataString,
cache: false,
success: function(newTableID) {
alert ('newTableID: ' + newTableID);
// Do some stuff with the ID
},
error: function(response) {
alert('failed: ' + response);
// The above displays "failed: [object Object]"
}
});
It doesn't matter what I have in my php script, I still get the same result: The alert in the error part of the ajax call displays a message box showing "failed: [object Object]". I've even tried a simple echo in the php script - I don't think the php script is running at all from this ajax call.
The url for the script is correct - the js file and the script.php file are in the same folder.
Can anyone shed some light on what I may be missing here?
Thanks.