jQuery 1.4.2 postnot working the same way as in 1.3.2
I have just updated to 1.4.2 and now everything that has worked before does not. And I cant figure out why.
var data = {
'what': 'post',
'type': $(this).attr('class'),
'id': $(this).next('input').val()
}
$.post(
'/开发者_运维技巧utils/ajax/',
data,
function(response) {
alert(response.result);
}, 'json'
);
It looks like now (after the update) I wont even get to the success function, although firebug says that everything was fine and shows the returned string. If that will help I am using django.
Any ideas are appreciated
Regards
Your problem is probably that JSON goes through much stricter validation in jQuery 1.4+, your JSON response must be valid, or it will silently fail. Check the response coming from the server here to make sure it's valid:
http://www.jsonlint.com/
If that's not the case...when you resolve the issue and generate valid JSON, your success
function will work again :)
精彩评论