The specific I probably use there are two kinds, need to cooperate with JQ.
First Kind, request pages directly via Ajax : for example,
1:datatype must be in HTML or text format,
2:type: Must be ' Post ' request
3: The background Load event must determine whether it is a POST request
The background code is as follows:
The test results are as follows:
The second type is similar to the. NET MVC direct Request method .
1: The background code, the introduction of using System.Web.Services;
2: The method must be a static modification, and the method above is marked with attributes [WebMethod]
3: Returns a successful callback function in JQ must be the return name. D such as: DATA.D
4:ajax, you must specify contenttype: "Application/json;charset=utf-8"
5: If you want to pass parameters, you need to add double quotes, such as: Data: "{' PageIndex ':" + PageIndex + "}"
Multiple formats are so. such as: Data: "{' PageIndex ':" + PageIndex + ", ' pagesize ':" +pagesize+ "}"
The background code is as follows:
The foreground code is as follows:
The test results are as follows:
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.