Found Ajax is really good dongdong: You can only pass the XML simple client want data.
Client Ajax Code:
Initiates a XMLHTTP request to the server.var http_request = null;function GetData (){Start initializing the XMLHttpRequest objectif (window.
A. What is Ajax?
Ajax is "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), a Web development technology that creates interactive Web applications. You can communicate with the server without refreshing the page. 1.XMLHttpRequest
1
Or a small rookie of me, the first time to write a blog, forgive Oh ...
The problem bothered me for two days, but it was so easy to find out ...
(1) The requirement is this, I want to implement a function of inserting a chart, the properties of the
keys and values are Dynamic Data Note if the data is {value:335, Name: ' Direct access '} This format needs to use eval (' + Strtojson + ') ') to turn
Load chart Start $ (function () {$.ajax ({//submit data type Post get type: "POST",//Submitted
One: Add ajax validation to an element in a form
Two: Define AJAX validation related parameters
$.validationenginelanguage.allrules.ajaxnamecall = {
"url": "/admin/user/validate",
//"message when
There are three main solutions to the problem of Ajax cross-domain problems
1. Use the proxy to mount the Cross-domain address below the domain
2. Use Jsonp
3. Use Access-control-allow-origin response Head
The first solution needs to introduce
When you encounter the need to verify the existence of existing records in the database, you need to first use Ajax to submit the background action to determine whether there are records in the database, by returning JSON data, reception in the
Problem Description
When using JavaScript for AJAX access, the following error occurred
Cause of error: JavaScript is in security consideration and is not allowed to be accessed across domains.The following illustration is an explanation of
Post-send data for example
function Chufa () {//html element event-triggered
var myxmlhttprequest = null;
if (window. ActiveXObject) {
myxmlhttprequest = new ActiveXObject ("Microsoft.XMLHTTP");
} else {
$.ajax ({
URL: "Http://www.xxx",//requested URL address
dataType: "JSON",//The format returned is JSON
async:true,//request is asynchronous, default true is asynchronous , this is an AJAX feature
data:{"id": "value"},//parameter
The restrictions on cross-domain communication are on the browser side, which is the client, so you can make a fuss from server-side code. This is the same as the last few days gzip, the problem is very similar to the gzip stream on the server
Get and POST requests are different:
1, to the server to pass the amount of data:
Get up to 2k
Post is not limited in principle, php.ini is limited to 8m
2, the transmission of data in a different form:
Get passes parameters in the form of a request
When using Ajax to perform an asynchronous refresh of a part of a page, after grabbing the packet, you can find that the problem is that if the contents of the form are unchanged, it does not make a request to the server, but instead caches the
/**//* the first way to create XMLHttpRequesttry{Searchreq = new ActiveXObject (' msxml2.xmlhttp ');}catch (e) {try{Searchreq = new ActiveXObject (' microsoft.xmlhttp ');}catch (e) {try{Searchreq = new XMLHttpRequest ();}catch (E){}}}*/The second
Because of the use of jquery, we need to introduce the JS file of jqueryIn the HTML header PlusThe specific directory location is changed according to your project.The HTML for the front end is as follows: "To make the code look clearer, I've
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