When the mobile Web page is too long, you can block the content and load it with Ajax.
The main ideas are as follows: Store the pages that need to be loaded in a new page, main code:
header ("Access-control-allow-origin: *");
Header
First, the XMLHttpRequest of the original ecology
The code is as follows
Copy Code
" method= "POST" >
Two, jquery Ajax.post
1.jQuery $.post () method
The $.post () method requests data from the server via an
$.get and $.post methods, the first argument is the address, the second is the passed value, and the third is the successful callback functionPost method:
The code is as follows
Copy Code
function Emailb () {var email = $
This article details how to use the jquery framework and the jquery address plug-in to achieve the most basic full-station AJAX dynamic loading of page content.
Case goalsThe common basic structure of the site as a case, the full station link AJAX
$pinyins = Array ();When the phonetic ishead=0 of a string of Chinese characters is obtained, the output pinyin first letter when outputting the whole phonetic ishead=1function Getpinyin ($str, $ishead =0, $isclose =1) {Global $pinyins;$restr =
Client:
Using $.getjson () when transferring the first parameter, that is, the URL, if a cross-domain request must have a parameter with a value of "?", such as:
The code is as follows
Copy Code
$.getjson ("Http://202.19
Ajax Entry Detection User name instance and implementation method
Username:
We also need a back-end page to determine if the input nickname exists (in this case, for example, PHP tutorial):
...
if (isset ($_get[' entryname ')
A method of automatic time saving for AJAX dataWindow.onload=function () {
var txtobj = document.getElementById (' txt1 ');var spanobj = document.getElementById (' s1 ');
Automatically saveTxtobj.addbehavior ("#default #userdata");
var
How to send a XMLHttpRequest retrieve HTML header data
The header resource returned by the getAllResponseHeaders () function. Title contains file information such as length, server type, content type, date modification, etc.
The header
AJAX sends a request to the server
Ajax-sends a request to the serverSend-Off requests to the server, we use the open () method and the Send () method.
The open () method has three arguments. The first parameter defines a method that uses a Send
JQ uses Ajax to submit all form data asynchronously, and callbacks
$ ("button"). Click (function () {var data = new FormData ($ (' #biaodan ') [0]); Get all of the data for a form$.ajax ({url: ' __controller__/saveorg ',.//ajax everyone
The main content of this section is to call the page background code method through AJAX to achieve the two-level linkage effect of the drop-down box. The implementation steps are as follows:1. Create the file Recipe24.aspx and implement the
With jquery, ajax has become quite simple.However, for simplicity, you may not need to load a huge js plug-in such as jquery in the project.But what should I do if I want to use ajax?Before implementing ajax, you must create an XMLHttpRequest object.
AJAX cache is intended to improve AJAX efficiency and reduce the pressure on the server. However, improper use may lead to unexpected results. There are several solutions to disable Ajax caching:1. Add the header ("Cache-Control: no-cache,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service