JQuery uses $. ajax for asynchronous refresh (with demo download) _ jquery

Source: Internet
Author: User
This article mainly introduces jQuery's usage of $. the asynchronous ajax refresh method involves some techniques related to jQuery's implementation of ajax asynchronous refresh for data interaction, and provides a complete demo for readers to download and reference, for more information about jQuery usage, see the example in this article. ajax asynchronous refresh method. We will share this with you for your reference. The details are as follows:

Recently, jquery is used to asynchronously read data. jquery provides many built-in asynchronous reading functions to demonstrate the most common $. ajax usage.

Enter a content in the client text box, and then return the time on the server.

The ashx file is used in the DEMO to obtain server information.

Slice

The escape () function can encode a string so that the string can be read on all computers.

Client code

<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Default7.aspx. cs" Inherits = "Default7" %>   
     
 
  
       

Server code

<%@ WebHandler Language="C#" Class="ContentHandler" %> using System; using System.Web; public class ContentHandler : IHttpHandler {  public void ProcessRequest (HttpContext context) {   string output = "";   string name = context.Request.Params["name"];   output = GetJsonData(name);   context.Response.ContentType = "text/plain";   context.Response.Write(output);  }  public bool IsReusable {   get {    return false;   }  }  public string GetJsonData(string aa)  {   string result = "{name:/""+aa+"/",dt:/""+DateTime.Now.ToString()+"/"}";   return result;  } }

Click here to download the complete instance code.

I hope this article will help you with jQuery programming.

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.