简体   繁体   中英

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': JSON.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.

Can you post the code you're using to make the AJAX call, and can you clarify how it doesn't work in IE? Is the call AJAX request not being made in IE, is the request returning an error, is there an issue handling the response?

Usually this would be attributed to extraneous commas, but you've already ruled them out so I think more information is required in order for us to assist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM