What is the concept of ajax in php
Today, the editor will share with you the relevant knowledge of what the concept of ajax is in php. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
In php, ajax means "asynchronous JavaScript and XML technology", which refers to a web page development technology that creates interactive web page applications. Ajax can make web pages update asynchronously, which is a technology that can update some web pages without reloading the whole web page.
The operating environment of this tutorial: windows7 system, javascript1.8.5&&PHP7.1 version, Dell G3 computer.
What does Ajax mean?
Ajax is the abbreviation of Asynchronous JavaScript and XML (Asynchronous JavaScript and XML Technology). It refers to a web page development technology for creating interactive web applications.
Ajax is not a new programming language, but a new way to use existing standards.
Ajax is a technology for creating fast dynamic web pages. By exchanging a small amount of data with the server in the background. Ajax enables web pages to be updated asynchronously. This means that some part of the page can be updated without reloading the entire page. On the other hand, traditional web pages (without ajax) must reload the entire web page if they need to update content.
After reading the meaning of ajax above, let's take a brief look at the pros and cons of ajax.
Advantages of ajax:
1, the biggest point is that the page is not refreshed, the user experience is very good.
2. Communicate with the server asynchronously, with more rapid response ability.
3. We can transfer the work of some previous servers to the client, make use of the idle ability of the client to deal with it, reduce the burden of the server and bandwidth, and save space and broadband rental costs. And reduce the burden on the server, ajax's principle is to "fetch data on demand", which can minimize the burden of redundant requests and responses on the server.
4. Based on standardized and widely supported technology, there is no need to download plug-ins or Mini Program.
5. Ajax can make Internet applications smaller, faster and more friendly.
Disadvantages of ajax:
1. Ajax does not support browser back button.
2. Security issues AJAX exposes the details of interacting with the server.
3. The support for search engine is weak.
4. Destroy the exception mechanism of the program.
5. It is not easy to debug.
Using ajax in php
When the user types characters in the input box above, the "showHint ()" function is executed. This function is triggered by the "onkeyup" event:
Function showHint (str) {if (str.length==0) {document.getElementById ("txtHint") [xss_clean] = "; return;} if (window.XMLHttpRequest) {/ / IE7+, Firefox, Chrome, Opera, code executed by Safari browser xmlhttp=new XMLHttpRequest ();} else {/ / IE6, code executed by IE5 browser xmlhttp=new ActiveXObject (" Microsoft.XMLHTTP ") } xmlhttp.onreadystatechange=function () {if (xmlhttp.readyState==4 & & xmlhttp.status==200) {document.getElementById ("txtHint") [xss_clean] = xmlhttp.responseText;}} xmlhttp.open ("GET", "gethint.php?q=" + str,true); xmlhttp.send ();}
Enter a name in the input box:
Name: