Jqueryajax simple example (interface + background) _ jquery

Source: Internet
Author: User
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;
}

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.