Breaking News
yeni film izle hd film seyret film izle

Ajax using the GET and POST method

GET AND POST methods are basically used as for sending the data from the form to the data processing page(server), both are used in form data handling process, but they have some difference for using.
Difference between GET and POST method:
GET method: The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the “?”. And method is restricted to send unto 1024 characters only. It will display in the address bar with the data sending in the form.
The Get is one the simplest Http method. Its main job is to ask the server for the resource. If the resource is available than it will given back to the user on your browser.
POST method: While in the post method the data send to the server does not any restriction, it does not display in the url, ie the request made by it is goes invisible, so it is a safe method for sending your passwords or private things.
The method is used in the ajax in open and send methods so we define them first.
This method is most powerful request.
Sending a request to the server the functions commonly used is:
1: open((“GET”,”url”,true):
The open method start the connection, in read or write mode, to receive data from the server or send it. It takes three arguments.
First paramenter : Defines the type of the method during a request is to be send(POST or GET).
Second parameter: Is for url of the serverside script(PHP script).
The third parameter :(true) says we’re going to make this request asynchronously which means we’re going to call the url and then go off and do other stuff without waiting for a response from the server. When the data gets back from the server the browser will call our callback function for us and we can process the data then.
2: send(): Sends the http request to the server. Null or empty with get command, string otherwise.
If all the files are in the same folder then:“GET”,”validate.php”,true);
Use of post functions:
Usually GET method is used while creating an Ajax application. But it will not be means that the post method is never used in ajax, there are several occasions when post is necessary for creating a Ajax application.Instead, post request are much secure than GET request.
USE OF GET Statement
var url = "get_method.php";
var params = "kam=al&name=eBIZ";"GET", url+"?"+params, true);
http.onreadystatechange = function() {//It Calls a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
Post Statement
var url = "post_data.php";
var params = " kam=al&name=eBIZ ";"POST", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "value of an HTTP header");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the  
    //state changes.
if(http.readyState == 4 && http.status == 200) {
Get Method:“GET”,url+”?”+params, true);

Post Method:“POST”, url, true);

In the post method no parameter is passed along with the query string. And the post method is much more tedious to write as it have the http.setRequestHeader method.