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 );
}