AJAX
Ajax is specifically related to PHP. Why AJAX IS SPECIAL? WHICH THING MAKES IT SPECIAL?
AJAX: - Means we can process data through behind the scenes of website just using JavaScript and XHTML. So it Asceronously send a value and retrieve something without having to reload the entire page.
First let’s understand how to open the file without refreshing the page. So create two file named home.php and include.inc.php file. Open include.inc.php file and write the code as given below.
Now open home1.php file and write the code as given below and run this page… You will see that it will display the output HELLO HARSHIDA PARMAR… But look very carefully when you run the page… during the display of data our page is going to reloaded…
Here we want to do the similar task but WITHOUT refreshing the page… Some function is predefined so here I am not going to explain each and every function… Remember one thing is in AJAX, all the variable and function is case sensitive.
Let’s understand the code which specify above
xmlhttp.onreadstatechange :- if our state is change perform the task which specify into the function body.
xmlhttp.readyState== 4 && xmlhttp.status==200:- If our state is 4 and status is 200 means status is not empty.
xmlhttp.open :- Taking the content of file include.inc.php file and replacing into the div which we have specify.





No comments:
Post a Comment