Asp.net uses ajax to transfer the value to the background and return the JSon data for parsing.

Source: Internet
Author: User

Ajax introduction

AJAX = asynchronous JavaScript and XML.

AJAX is a technology used to create fast dynamic web pages.

By performing a small amount of data exchange with the server in the background, AJAX can implement asynchronous updates on webpages. This means that you can update a part of a webpage without reloading the entire webpage.

If you need to update the content of a traditional web page (without AJAX), you must reload the entire web page.

There are many AJAX application cases: Sina Weibo, Google Maps, Kaixin.com, and so on.

AJAX definition reference http://www.w3school.com.cn/jquery/ajax_ajax.aspjquery ajax method
AJAX front-end call:

$. Ajax ({
Url: "/manage/getCard ",
Type: 'post ',
Data: {"labL": labL, "labA": labA, "labB": labB, "state": state, "config1": config1, "config2": config2, "config3": config3 },
Success: function (data) {// return data after successful sending, and then execute success:
// Alert (data [0]. cd_ID );
// Alert (data. length );
For (var I = 0; I <data. length; I ++)
        {
Var gb = data [I]. cd_RGB;
Var id = null;
Id = data [I]. cd_ID;
$ ('. Color_list'). append ('<div id = "resultColor" class = "resultColor" cd_id =' + data [I]. cd_ID
+ 'Style = "width: 100%; height: 200px; background-color: '+ gb +'; margin-Bottom: 20px;"> </div> ');
    
$ (". ResultColor: eq (" + I + ")"). click (function (){
Var a = $ (this). attr ("cd_id ");
}}


The background receives and places the JSON back:

Public ActionResult getLAB (string tb_rgbR, string tb_rgbG, string tb_rgbB)
{

Var resultJson = new {

L = tb_labL,
A = tb_labA,
B = tb_labB
};
Return Json (resultJson );
}

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.