Loading
An AJAX call to Servlet

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  How you make an AJAX call to Servlet and return the XML response


Ans)

We could make a AJAX call from browser using "XMLHttpRequest". The XMLHttpRequest
object provide a method for exchanging data asynchronously between browser and
server to avoid full page reloads.

Here is the quick example:

             function makeAjaxCall(){
                if(window.XMLHttpRequest){
                                alert("XMLHttpRequest supported by browser ee");
                                xhttp = new XMLHttpRequest();
                                        url='http://localhost:8080/test/post.do';
                                xhttp.open("GET", url, false);  
                                alert("reching your Request ?");
                                xhttp.send();

                        alert(xhttp.responseText);
                            }
                            if(window.ActiveXObject){
                                alert("ActiveXObject supported by browser");
                            }
             }



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

An AJAX call to Servlet


An AJAX call to Servlet

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free