AJAX in php

Today's Post about  Ajax 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 request and also provide the code

so guys first of all we have must knowledge about that what is Ajax  in php.


ajax-in-php


What is Ajax?

Ajax mean (Asynchronous Javascript and XML.)  this is also part of  php Web development, Ajax is not a stand-alone language or technology.

It is a technique that combines a set of  known technologies in order to create faster and more user friendly web pages. because It is a client side technology.

Simply Main Purpose of Ajax that prevents unnecessary reloading of a page.
When we submit a form, although most of the page remains the same, whole page is reloaded from
the server this causes very long waiting times and waste of bandwidth. 

AJAX aims at loading only the necessary information, and making only the necessary changes on 
the current page without reloading the whole page.

AJAX uses following technologies

*  Javascript (for altering the page) 

* XML (for information exchange) 

* PHP or JSP (server side)

Ajax (sometimes written AJAX) is a means of using JavaScript to communicate with a web server 
without submitting a form or loading a new page. 

AJAX is based on Javascript, and the main functionality is to access the web server inside the 
Javascript code. 

We access to the server using special objects; we send data and retrieve data.


The XMLHttpRequest object


The XMLHttpRequest object is the backbone of every Ajax method. Each application requires the
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>

XMLHttpRequest object properties


ajax in php



We use the ready-state to determine when the request has been completed, and then check the
status to se if it executed without an error. (We’ll see how to do this shortly.)


XMLHttpRequest properties(ready-state)


Ajax-in-php-ready-state


XMLHttpRequest properties(status)





Ajax-in-php-state




XMLHttpRequest Method


abort()
getAllResponseHeaders()
getResponseHeader( “headername” )
open(“method” , “url” async );

-open( “GET” , “myfile.php” , true )
send( content )
setRequestHeader( “label” , “value” )


you can also red following post.

Error Reporting 

Calaulator 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

Name

Blogging,5,How to,9,Make Money,4,SEO,4,Tricks & Tips,4,Web Designing,10,Web Development,5,
ltr
item
Web Log Tricks: AJAX in php
AJAX in php
Jquery AJAX (Asynchronous JavaScript and XML) step by step in php and mysql and also this code tutorial from database
https://3.bp.blogspot.com/-swHvLRQXegw/WKKqd4UuzrI/AAAAAAAAAUs/P9lfs5mPhAIkwf9axPUIDeL9Z1sCA11FwCLcB/s640/Presentation1.jpg
https://3.bp.blogspot.com/-swHvLRQXegw/WKKqd4UuzrI/AAAAAAAAAUs/P9lfs5mPhAIkwf9axPUIDeL9Z1sCA11FwCLcB/s72-c/Presentation1.jpg
Web Log Tricks
http://www.weblogtricks.com/2017/02/ajax-in-php.html
http://www.weblogtricks.com/
http://www.weblogtricks.com/
http://www.weblogtricks.com/2017/02/ajax-in-php.html
true
3158682668530211189
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy