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
Tables can be built on their own, only classid,title,content,updatetime,id five fields
Home index.php
The code is as follows
Copy Code
www.corange.cn "name=" ClassID "id=" ClassID "/>Title:Content:
ok.php
$.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 = $
JSON (JavaScript Object notation) is a lightweight data interchange format. JSON stores data that is structured as "key-value." Sometimes we need to read JSON-formatted data files, which can be implemented in jquery using Ajax or $.getjson ()
The title, Imitation Sina Weibo home page scrolling effect written a jquery plugin.Just began to practice writing Jquyer plug-ins, not very skilled, make up with the first.The code is as follows:
The code is as follows
Copy Code
var info = document.getElementById ("TXT"). Value;
Jquery.ajax ({
Type: ' Get ',
URL: ' http://localhost:8080/jdom/hehe.do?act= page special effects on ',
Data: "&info=" +info,
Cache:false,
DataType: ' JSON ',//Specifying return type
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
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
The Simple new
First you need to create a new variable and assign it a XMLHttpRequest object instance. This is simple in JavaScript, as long as you use the New keyword for the object name, as shown in Listing 1.
Listing 1. Create a new
What is AJAX?
AJAX (Asynchronous JavaScript and XML, asynchronous JavaScript and XML technology) is a new word, but the implication is that two JavaScript features exist for some time. These two functions have been neglected in the past, in Gmail,
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
Tip: you can modify some code before running : Ajax loading effect code :: Loading... Chargement de la page termin ?.. Tip: you can modify some code before running
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.