开发者

jQuery ajax call error if only one data param in IE8?

I've got this javascript that works fine in Chrome but in IE the 'data' var passed in the Success function is always an empty string. What's more my handler is not even hit!

(jQuery 1.6.2)

$.ajax({
    url: "/rb.ashx",
            type: "GET",
            data: ({ cmd: 'getpmcount' }),
            async: true,
            success: function (data) {
                alert('unread 开发者_如何学Python[' + data + ']'); 
            }
        });

if however I add a dummy param to the outgoing data:

 $.ajax({
    url: "/rb.ashx",
            type: "GET",
            data: ({ cmd: 'getpmcount', x:'x' }),
            async: true,
            success: function (data) {
                alert('unread [' + data + ']'); 
            }
        });

it works fine!!

Can anyone explain why this might be the case? I'd rather have it work properly than have this hack in place.

Thanks.


Looks like it was some strange caching issue. I added cache: false to the ajax calls and all is working. Odd.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜