The jqueryajax example contains the interface and background parts. The test results are good. You can use the jqueryajax example or modify the interface twice:
The Code is as follows:
Script
$ (Document). ready (function (){
$ ("# B01"). click (function (){
Htmlobj = $. ajax ({url: "/Content/upFile/test .txt", async: false });
$ ("# P01" ).html (htmlobj. responseText );
});
});
$ (Document). ready (function (){
$ ("# Test"). load ("/Content/upFile/test 2.txt # p1", function (responseTxt, statusTxt, xhr ){
If (statusTxt = "success ")
Alert ("external content loaded successfully! "+ Xhr );
If (statusTxt = "error ")
Alert ("Error:" + xhr. status + ":" + xhr. statusText );
});
});
$ (Document). ready (function (){
$ ("# Getbutton"). click (function (){
$. Get ("/DownSet/index", function (data, status ){
Alert ("data:" + data + "\ n status:" + status );
});
});
});
$ (Document). ready (function (){
$ ("# Postbutton"). click (function (){
$. Get ("/CustomerInformation/getS", {par: "ww"}, function (data, status ){
Alert ("data:" + data + "\ n status:" + status );
$ ("# PostText" pai.html (data );
});
});
});
Script
After the post method loads the text, it will be displayed here
After the get method loads the text, it will be displayed here
The jquery load method is displayed here.
The loaded text will be displayed here
The loaded text will be displayed here
Background:
The Code is as follows:
Public string getS (string par)
{
String content = "";
If (par. Equals ("ww "))
{
Content = "cheng gong le ";
}
Else
{
Content = "shi bai le ";
}
Return content;
}