Solved

JavaScript XML request without callback?

Posted on 2009-06-29
3
478 Views
Last Modified: 2013-11-23
Hi there,

Are there any JavaScript XML libraries out there that let us make XML calls without requiring a callback?
Why? Because we are trying to rapidly develop an application and with all the callbacks, things are really looking messy in the code.

0
Comment
Question by:the_cyman
3 Comments
 
LVL 9

Assisted Solution

by:jmanGJHS97
jmanGJHS97 earned 450 total points
ID: 24739627
Any asynchronous interactions with server components require callbacks.  Maybe instead you could restructure the callbacks to be more efficient, but you can't simply avoid them.
0
 
LVL 7

Expert Comment

by:Xxavier
ID: 24741356
XML calls are call backs, to get data from server you have to call back, period :(
0
 

Accepted Solution

by:
the_cyman earned 0 total points
ID: 24817673
It is possible:
function GetSynchronousJSONResponse(url, postData) {
    var xmlhttp = null;
    if (window.XMLHttpRequest)
        xmlhttp = new XMLHttpRequest();
    else if (window.ActiveXObject) {
        if (new ActiveXObject("Microsoft.XMLHTTP"))
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        else
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
        // to be ensure non-cached version of response
    url = url + "?rnd=" + Math.random();
   
    xmlhttp.open("POST", url, false);//false means synchronous
    xmlhttp.send(postData);
    var responseText = xmlhttp.responseText;
    return responseText;
}
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now