Problem with JQuery Mobile and AJAX Post
I'm stumped with this one, for some reason only on Blackberry, I'm not hitt开发者_如何学运维ing the inner "function" on post. I'm using the latest JQuery Mobile. Anyone have an idea?:
function test(data1)
{
alert("I do get here!");
$.post("test.php",
{ data: data1 },
function(xml) {
alert("never here!");
}
);
}
I had this issue too, but only with 5.x OS. 6.0 works fine. For whatever reason the data returned from IIS in my case is causing the post to look like it didn't succeed -- even though it clearly does.
That will only happen onSuccess
. Add an error
handler to see what is going wrong.
http://api.jquery.com/jQuery.ajax/
http://api.jquery.com/ajaxError/
The most likely cause is that the call isn't resulting in a success and the callback specified for the post()
helper method only gets invoked in case of success. Try either unwrapping the call into a straight ajax()
call or setting the ajaxError()
or ajaxComplete()
callbacks to see if there is an actual issue.
The solution ended up being to change the method to a GET. I'm not sure why but Blackberry browser doesn't seem to support JQuery POST.
精彩评论