开发者

Page not loading fully after firing a jQuery ajax request

开发者 https://www.devze.com 2023-01-27 13:49 出处:网络
I am facing a strange issue where-in my webpage does not load fully after firing a jQuery ajax POST request. I have a webpage that gets some html data from server via web service. I used jQuery ajax m

I am facing a strange issue where-in my webpage does not load fully after firing a jQuery ajax POST request. I have a webpage that gets some html data from server via web service. I used jQuery ajax method to get data. However some times the although the data is received fully, the status bar still shows 开发者_高级运维progress bar and halts there. As soon as I click on page somewhere, the progress bar completes and full page is shown. The status bar shows it is loading some image and halts. My images are hardly 1-2 kb and 2-3 on the whole page.

Previously I had set async: false but then removed with no change. Any help would be appreciated.

UPDATE CODE:

$.ajax({
    type: "POST",
    url: "WebServerice/WebMethod",
    contentType: "application/json; charset=utf-8",
    data: {},
    dataType: "json",
    success: function(response){
        $("#myDivID").html(response.d);
        if(response.d !== '') {
            $('#lnk').click(function(){
                alert('You clicked link');
            });
        }
    },
    error: function(oError) {
        alert(oError.responseText);
    }
});


Ok. So the issue is resolved. In my previous code, I had async: false in my jQuery AJAX call. I later on made it to async: true. On Win 7 with II 7 it worked fine, but not on Win Server 2k8 + IIS 7.5. I restarted the IIS and tested and it worked fine.

Thanks for your responses gov.

0

精彩评论

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