开发者

jQuery AJAX call to Java/Wicket server gets no response in IE (6/7/8)

Note: This relates to a previous question.

I have a Wicket page that has a form with some complex client-side interactions that I decided to use jQuery for instead of Wicket (long discussion, I know). Essentially I'm just building a JSON object, submitting it via AJAX, and performing some action on completion. The call works fine in Firefox, but not in any version of IE. I've already verified that there are no extraneous commas. Here's the code:

var lookup = {
    'name': name,
    'description': description,
    'items': [{
        'name': itemName,
        'value': itemValue
    }]
};

$.ajax({
    type: 'post',
    url: '${callbackURL}', // This file is parsed by Wicket and receives a dynamic callback URL here. This is not jQuery!
    cache: false,
    data: {'lookup': J开发者_JAVA百科SON.stringify(lookup)},
    contentType: 'application/json',
    complete: function() {
        alert('This never gets called in IE!')
    }
});

Any suggestions? Thanks!

Update: It appears my problem is due to IE caching the resources. I've put no-cache code in my HTML file, but it seems that either the page is still getting cached (and by extension, the JS it references), or the JS file with my jQuery code in it is being cached with the old callback URL in it so that the server doesn't respond because there's nothing at that URL anymore. When I remove the pretty URLs everything works fine (because every time Wicket generates the URL, it's unique). Still, shouldn't the complete function get called even if there's no server response?


This was due to aggressive IE caching. It was resolved by adding a uniquely generated parameter to the URL so the browser would think it's a new URL every time.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜