In this tutorial, we are using easy method of Ajax and java script without using the JQuery code. first of all it check browser and then create an XMLHttpRequest object depends on the browser type. then we select one method GET or POST for sending the data over browser.

Step1: - Checking browser and creating XMLHttpRequest object.




Example: - (Get Request)

xmlHttp.open("GET",URL,true);
xmlHttp.send();

In above syntax is Explaining: -

1st Parameter  - Request Type (Get or Post)
2nd Parameter - Explaining the URL where data consists.
3rd Parameter - Synchronous or asynchronous Request.

send();   // This Method Function send data to server and used for post method only.

Example: - (Post Request)

xmlHttp.open("POST",URL,true);
xmlHttp.send();
For post any data to server we need to add header in between the code like: -


xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.send();

If you are facing any problem then contact me through contact form and have query(Blogging, Adsense, programming tips) then ask from the comment box. I will reply as soon as possible. dont forget to give feedback in comment area.

Thanks,

0 comments :

Post a Comment

 
# Top