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

  • SEARCH
  • Home
  • 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 8891169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:40:13+00:00 2026-06-14T22:40:13+00:00

I am doing cross domain call. This is taking more time(some ms or 1s).

  • 0

I am doing cross domain call.
This is taking more time(some ms or 1s).

so below that code is executing.

var xdr;
    if (window.XDomainRequest) // Check whether the browser supports XDR. 
    {
        xdr = new XDomainRequest(); // Create a new XDR object.
        if (xdr) {
            xdr.onload = function () {
                var data = $.parseJSON(xdr.responseText);
                AddData(data, link);
            };
            xdr.open("post", urlSearch);
            xdr.send();
        }
        else {
            alert('Server Error!! Try Later.');
        }
    }
    else {
         alert("Not IE 8");
     }

I want to do that synchronous.
So that after that call finished below code will execute

please help

Thanks in advance.

  • 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-06-14T22:40:14+00:00Added an answer on June 14, 2026 at 10:40 pm

    Just to clarify, since some “JavaScript” programmers tend to be actually jQuery programmers ( and I doubt that they can even be that, I’m talking about comments ).

    Back to the topic. After few minutes of googling it seems that XDomainRequest object does not support synchronous calls.

    And this is actually good. What you don’t know is that synchronous AJAX ( note that synchronous AJAX is a contradiction on its own – first A stands for Asynchronous ) is the root of all evil in browsers. Why? Because JavaScript is single-threaded, so when user waits for a request to finish he can’t do anything – entire page is blocked ( and in some worse cases, like IE8 I believe, entire browser is blocked ).

    So what should you do? You should do what every good JavaScript programmer does and write your code in an asynchronous way. For example:

    var xdr;
    if (window.XDomainRequest) { // Check whether the browser supports XDR. 
        xdr = new XDomainRequest(); // Create a new XDR object.
        xdr.onload = function () {
            var data = $.parseJSON(xdr.responseText);
            AddData(data, link);
            // other code goes here
        };
        xdr.onerror = function () {
            alert('Server Error!! Try Later.');
        };
        xdr.open("post", urlSearch);
        xdr.send();
    } else {
        alert("Not IE 8");
    }
    

    If you have more code that depends on xdr, then simply add it to onload handler ( you can wrap it in a separate function to make it easier to read ).

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

Sidebar

Related Questions

I am doing a cross domain post in .net, but in net they have
I'm doing some fairly simple cross-platform TCP socket programming. I have unfortunately found out
I'm doing some work for a charity that's having a fund drive. Whenever someone
I am doing a cross domain request using $.ajax . It works on Firefox
I am doing a cross-domain json post utilizing asp.net web api. On my service
I'm doing cross-domain requests and once the first request is made I need to
I can't find this anywhere and i don't know why the cross domain REST
i'm doing a crossdomain ajax call to get some data out of my rails
As you know doing Cross Domain XMLHTTP requests is not allowed for security reasons
I'm having a lot of trouble to execute cross domain REST call with Jquery

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.