开发者

jQuery 1.4.2 postnot working the same way as in 1.3.2

开发者 https://www.devze.com 2023-01-13 12:54 出处:网络
I have just updated to 1.4.2 and now everything that has worked before does not. And I cant figure out why.

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消