AJAX calls fail in Opera and IE8
For some reason, AJAX requests seem to be failing in both Opera 11.51 and IE8 but work in Firefox and Chrome. I am not doing anything fancy other than the standard post request call:
$.post开发者_运维百科('/dashboard/valid_email/', { email:email }, function(data) {
I've added an alert before and after the AJAX call and I only get one alert which means the callback function isn't called.
I am using jquery.1.6.2 hosted on Google.
Any ideas?
Add an error handler to see what error is being thrown. If you are returning something other than text/html
, you need to set the dataType
parameter to the proper dataType.
Parse error means that there is something wrong with the data you are returning; if you are returning html, then the html is not valid, and if you are returning json, the json is not well-formed.
$.post(url,data,callback,datatype).fail(function(x,y,z){
alert(x + "\n" + y + "\n" + z);
})
I finally found out what the problem was. I was making use of mouseflow and it was causing problems for some reason on those two browsers! I just removed it and won't be using mouseflow again. I've let the developers know - maybe they can apply a fix.
One error I see: You need to change email
to 'email'
:
$.post('/dashboard/valid_email/', { 'email' : email }, function(data) {
It's not likely your whole problem, but it needs correction.
精彩评论