Method One:
We pass the HTTP 204 status code, the page does not jump. The 1.html code is as follows:
<! DOCTYPE html>
The add.php code is as follows:<?php$num = file_get_contents ('./num.txt '); $num = Intval ($num) + 1;file_put_contents ('./num.txt ', $num); Header (' http/1.1 204 No Content ');
Method Two: Use the image loading feature to complete the request.<! DOCTYPE html>
Method Three: Take advantage of css,javascript loading characteristics, complete the request, the same principle as the IMG load. Method Four: The features of the IFRAME using the 2.html code are as follows:<! DOCTYPE html>
The ret.php code is as follows:<?php$uname =!empty ($_post[' uname ')? $_post[' uname ': '; $upwd =!empty ($_post[' upwd '])? $_post[' upwd ': '; if ($uname = = ' Admin ' && $upwd = = ' 123456 ') { echo ' <script> Parent.document.getElementById (' result '). innerhtml= ' OK ';</script> ";} else { echo "<script>parent.document.getelementbyid (' result '). Innerhtml= ' NO ';</script>";}
We do not jump the form by setting the target to the iframe that the form submits. Can ajax implement file uploads? Analysis, file upload, it is necessary for the client to send the contents of the file to the server, that is, the XHR object in the post data, the file content is also sent to the server. That is, the XHR object can get the content of the file you want to upload, but for security reasons, JS cannot get the contents of the local file. How does the Ajax plugin implement file uploads?1, iframe2, flash implementation, such as SWFUPLOAD3, HTML5 (add the file read API, make Ajax upload files possible. )
A method of non-flush implementation of PHP