The backend accepts the instance code for passing ajax values, and the backend ajax transmits instances.
The backend instance code that accepts the value passed by ajax:
Ajax can be used to implement interaction between non-refreshing data. The following is an example code that receives ajax passed values for your reference.
The ajax code is as follows:
$(function (){ timestamp=0; $("#chatform").submit(function (){ var message=$("#msg").val(); var name=$("#author").val(); var action="postmsg"; var time=timestamp; $.post( "backend.aspx",{ arr: message+","+name+","+action+","+time }, function (xml){ $("#msg").val(""); addMessages(xml); }); return false; }) })
To $. the post method does not support passing parameters in the form of arrays. Therefore, it is passed as a string in the above jquery code. The aspx page in the background can be split as an array after receiving, the Code is as follows:
string arr = Request["arr"].ToString(); string[] myarr = arr.Split(','); string message = myarr[0]; string name = myarr[1]; string action = myarr[2]; string time = myarr[3];
Original address: http://www.51texiao.cn/jqueryjiaocheng/2015/0613/4045.html
The most original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 8328.