Implementation of AJAX second-level linkage instance analysis using jQuery + JSON

Source: Internet
Author: User
This article mainly introduces jQuery + JSON to implement AJAX second-level interaction. It analyzes the front-end jQuery in combination with ajax to transmit json format data and background data processing techniques in the form of examples, which has some reference value, for more information about how to implement AJAX second-level interaction using jQuery + JSON, see the following example. We will share this with you for your reference. The details are as follows:

Background Handler. ashx

<%@ WebHandler Language="C#" Class="Handler" %>using System;using System.Web;using System.Data;public class Handler : IHttpHandler{ Common coObj = new Common(); public void ProcessRequest(HttpContext context) {  if (context.Request.Params["n"] != null)  {   string num = context.Request.Params["n"].ToString();   context.Response.ContentType = "text/plain";   string str = "select * from address where a_num2=" + num;   DataTable dt = coObj.GetTable(str);   string json = JSONHelper.DataTableToJSON(dt);   context.Response.Write(json);  } } public bool IsReusable {  get  {   return false;  } }}

Frontend dropdownlist.html

Dropdowngrading
 

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.