1.ajax异步
有参数
1)form表单
$.ajax({
url: "Handle/OrderData.ashx?action=ScanCodeConfirm", //一般处理程序
type: "post",
data: $("#form1").serialize() , //传递的数据
dataType: "json", //数据类型json
success: function (data) { //成功执行
if (data.success) {
}
else {
}
}
});
2)拼接
$.ajax({
url: "Handle/OrderData.ashx?action=ScanCodeConfirm",
type: "post",
data: $("#form1").serialize() + "&g_pieces=" + g_pieces + "&g_length=" + g_length,
dataType: "json",
success: function (data) {
if (data.success) {
}
else {
}
}
});
3)
$.ajax({
url: "/Handle/OrderData.ashx?action=RecSendUserInfo",
type: "post",
data:{countryID:countryID},
dataType: "json",
success: function (data) {
if (data.success) {
}
else {
}
}
});
2.无参数
function rec_iinfo()
{
$.ajax({
url: "Handle/OrderData.ashx?action=getRec",
type: "post",
dataType: "json",
success: function (data) {
if (data.success) {
}
}
});
}
详见:http://www.w3school.com.cn/jquery/ajax_ajax.asp