Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 987637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:30:40+00:00 2026-05-16T05:30:40+00:00

I have an aspx page on which I am using XDomainRequest object to populate

  • 0

I have an aspx page on which I am using XDomainRequest object to populate two div(s) with html returned from AJAX response.
I have used Jquery to get the divs and perform “each()” on the retrieved List

var divs = $("div");
divs.each(function(index) {
    if (window.XDomainRequest) {
        xdr = new XDomainRequest();
        if (xdr) {
            xdr.onload = function() {
                alert("XDR Response - " + xdr.responseText);
                var currentDivID = divs[index].attributes["id"].value;
                var selectedDiv = $("div[id='" + currentDivID + "']");
                if (xdr.responseText == '') selectedDiv.attr("style", "display:none;");
                else selectedDiv.append(xdr.responseText);
            };
            xdr.open("GET", xdrUrl);
            try {
                xdr.send();
            } catch (e) {
                alert(e);
            }
        } else {
            alert('Create XDR failed.');
        }
    } else {
        alert('XDR not found on window object .');
    }
}

Now, whats happening is , i have two Divs on a page that have different IDs and when this code runs on “$.ready(function(){})” , both requests are asynchronously sent to the server and processed

the result is
1. sometimes the onload get the response for the second div in both div results.
2. IE sents only one request to the server(I am using fiddler to see what requests are sent to server).

Can anybody guide me whats wrong with the code ? As far as I know XDR does not support synchronous calls, and asynchronous calls are giving me wrong results. Any workaround/tip for this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:30:40+00:00Added an answer on May 16, 2026 at 5:30 am

    Issue solved by myself when I pointed out a mistake in my code:(.

    xdr = new XDomainRequest(); 
    

    should be

    var xdr = new XDomainRequest(); 
    

    For Point 2 , I added “Cache-Control:no-cache” header in my response and it solved the matter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASPX page (On server A) which is invoked using NTLM credentials.
I have Default.aspx page, which inherits from BasePage.cs, which inherits from System.Web.UI.Page. BasePage is
I have one aspx page with some controls. Also i have one DIV which
I am using jquery ajax method on my aspx page,which will invoke the webmethod
I have a html page which loads a flash(flex) swf file. Using https it
I have a panel on an aspx page which contains an UpdatePanel. This panel
If I have a page with outputcaching (let's call it Employees.aspx) which accepts one
I have an aspx page which has a GridView and a Panel with Summary
I have a standard aspx page with which I need to add another standard
I have an aspx web page (opener) which opens a popup window In the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.