[jQuery] Ajax seems to be running fine, but is running the 'error' function. What am I doing wrong?
I have an Ajax function I'm using to test right now. When the function
is called (upon a click), it runs the function, but displays the
"Error, please try again" message. In Firebug, it looks like the
function is returning the correct msg. I was using 1.0.2 (I think)
where it worked, minus the replaceWith function, and then I upgraded
to 1.1.2 and now it's showing the error message.
Here's the function below, any ideas on what I'm doing wrong?
function testAjax(id,page,sort) {
$.ajax({
url: 'ajaxtable/refresh',
type: 'GET',
data: 'id=' + id + '&page=' + page + '&sort=' + sort,
error: function(){
alert('Error, please try again');
},
success: function(msg){
$('div').replaceWith('<div>Test</div>' );
alert(msg);
}
});
}
Thanks!