Today's Post about Ajax PHP mean (Asynchronous Javascript and XML.) this is also part of PHP Web development,
In This Tutorial, I will tell you Ajax property and it is an Ajax request and also provide the Ajax code. and What is the use of ajax in PHP
In This Tutorial, I will tell you Ajax property and it is an Ajax request and also provide the Ajax code. and What is the use of ajax in PHP
What is Ajax and how to use Ajax in PHP?
Ajax means (Asynchronous Javascript and XML.) Ajax PHP is not a stand-alone language or technology it's a technique that combines a set of known technologies in order to create faster and more user-friendly web pages.
because It's a client-side technology simply the main purpose of Ajax PHP that prevents unnecessary reloading of a page.
When we submit a form, although most of the page remains the same, the whole page is reloaded from the server this causes very long waiting for times and waste of bandwidth.
because It's a client-side technology simply the main purpose of Ajax PHP that prevents unnecessary reloading of a page.
When we submit a form, although most of the page remains the same, the whole page is reloaded from the server this causes very long waiting for times and waste of bandwidth.
AJAX PHP aims at loading only the necessary information and making only the necessary changes on the current page without reloading the whole page.
* Javascript Ajax (for altering the page)
* XML (for information exchange)
* PHP Ajax or JSP (server-side)
Ajax (sometimes written AJAX) is a means of using JavaScript Ajax to communicate with a web server without submitting a form or loading a new page.
AJAX is based on Javascript Ajax, and the main functionality is to access the webserver inside the
The XMLHttpRequest object is the backbone of every Ajax method. Each application requires the
Firefox, Safari, Opera and some other browsers can create one of these objects simply using the
We use the ready-state to determine when the request has been completed, and then check the
you can also read the following post.
Error Reporting
Calculator in Php
==================================================================
AJAX is based on Javascript Ajax, and the main functionality is to access the webserver inside the
Javascript code. we access the server using special objects; we send data and retrieve data.
The XML Http Request object
creation of one of these objects. So how do we do it?
Firefox, Safari, Opera and some other browsers can create one of these objects simply using the
“new” keyword.
<script type="text/javascript">
ajaxRequest = new XMLHttpRequest(); </script>
XML Http Request object properties
We use the ready-state to determine when the request has been completed, and then check the
status to see if it executed without any error. (We’ll see how to do this shortly.)
XML Http Request properties(ready-state)
XML Http Request properties(status)
XML Http Request Method
abort()
getAllResponseHeaders()
getResponseHeader( “headername” )
open(“method” , “url” async );
-open( “GET” , “myfile.php” , true )
send( content )
setRequestHeader( “label” , “value” )
you can also read the following post.
Error Reporting
Calculator in Php
==================================================================
Ajax code
<script type="application/javascript">
function formData(){
xhr;
if(window.XMLHttpRequest){
// checking browser like chrome , firefox etc......
xhr = new XMLHttpRequest(); // creating object of XMLHttpRequest
} else {
// code for IE6, IE5
xhr= new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function(){
// onreadystatechange event with js function which has no name
// but onreadystatechange check readystate value like 0 , 1, .... 4
if( xhr.readyState == 4 && xhr.status == 200 )
{
// if condition ~ 404 page not found ~ 200 page exist
document.getElementById( "form" ).innerHTML =
xhr.responseText ;
// xhr response text inserting in html
element
} // end if condition
} // end onreadystatechange
xhr.open("GET" , "form.php" , true) ; // open
method
xhr.send( null ); // finaly sending xhr request
.....
} // formData()
</script>
<a href="javascript:void(0)" onClick="formData()">
click here </a>
<div id="form"></div>
COMMENTS