Recently, I have been studying the Ajax-enabled WCF method to provide services directly to the front-end. I have encountered some minor problems in the optimization of returned data, which are summarized as follows:
Problem 1: If you want the WCF
I will not blow off the ease of server operations. Everyone on the Earth knows that it is the most annoying thing to do is page refresh, and his head is dizzy, and when he is refreshing, also trigger server-side events (solution:
HTTP status
Code Instructions:
2XX successful
200 normal; the request has been completed.
201 normal; followed by the POST command.
202 normal; accepted for processing, but not completed.
203 normal; partial information-only part of the returned
1. Ensure security at the front and back ends.
The front-end cannot be used alone for security verification. The backend must also have a filtering mechanism to check the information sent in front. Since Ajax will also receive information sent
Previously, Ajax was implemented one by one using JavaScript scripts, Which is cumbersome. After learning jquery, I feel that it is not that difficult to implement Ajax. Of course, in addition to the jquery framework, there are other excellent
First look at the call method:
CopyCode The Code is as follows: Ajax. Request ("ajax.html", {v: Math. Random (), num: 1}, function (data ){
// Do something
}, 'Get ');
The method is like jquery... I still think this call is more convenient...
In a recent project, ajax cross-Origin data retrieval is required. If it is true that there is no problem in the current domain, a prompt box is displayed in the browser of the second-level domain and other domains: "This page is accessing data out
Today, I want to implement an Asynchronous interaction process that reads data from xml using $. ajax ().
The initial code is as follows:
$.ajax({ type: "get", url: "Database/App_all.xml", dataType: "xml",
When we switch the tab, if ajax technology is used, we will encounter the following situation: Click the tab1 option, the server sends an Ajax request to obtain the content data of this option tab1. If the request is being processed and you click
AjaxI have heard a lot about this word, but I have never really touched it, so I 'd like to know it here.
The innovation of Ajax technology is that it improves the traditional "request-wait-response-refresh-return data" mode. Before returning
1. Create a demo. aspx page.
2. Add references to the background file demos. aspx. cs on the page.
Using System. Web. Services;3. method call without parameters. You must note that this version cannot be lower than. net framework 2.0. 2.0 is not
Copy codeThe Code is as follows: Easy. Ajax = {
ProxyPool :{
Length: function (){
Var I = 0;
For (var p in this)
I ++;
Return I-1;
}
},
Index: 0,
Async: true,
XmlData: false,
Timeout: 1,
DefaultHeader: 'application/json; charset = UTF-8 ',
Revoke
Yes, what we want to achieve today is to read and Display Server data without refreshing the webpage.
Take out what we prepared last time.
1: function of the XMLHTTPRequest object.
2: Asp outputs an xml file. You can click to view the File
Demo page implementation
Copy codeThe Code is as follows:
This document is good.
70% (7000)
documents to be improved
30% (3000)
The main point is to control the g_img width by percentage. css code will not be pasted
1, Content-Type
In many cases, the Content-Type issue cannot be resolved.
Skip this step if it is an xml file.
The dynamically generated XML must be set to text/xml. Otherwise, text/html is the common text by default.
Set Content-Type in common
I. JS part
Copy codeThe Code is as follows: //************************************** ******************
// Creation date:
// OPERATOR: oloen
// Content Description: Automatically complete the JS class
// Usage:
// Var auto = new autoComplete (Client
// Create a component
Function createobj (){
If (window. ActiveXObject ){
Return (new ActiveXObject ("Microsoft. XMLHTTP "));
}
Else if (window. XMLHttpRequest ){
Return (new XMLHttpRequest ());
}
}
Var cs;// Send the requestFunction sxs (Fileid
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