×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Eu Wern Teh
Added: Feb 27, 2013 6:10 AM
Views: 31
Read the following resource for details
https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest
http://www.w3schools.com/ajax/ajax_xmlhttprequest_create.asp
  1. xhr = new XMLHttpRequest();
  2. xhr.open("GET","URL",true); //last parameter indicates - async (true or false)
  3.  
  4. //Setting onload function to response to ajax call once it is completed.
  5. xhr.onload = function(){
  6.     //this.responseText - will be the output return from ajax call
  7.     console.log(this.responseText);
  8. };
  9.  
  10. xhr.send();