异步 Ajax格式

前端之家收集整理的这篇文章主要介绍了异步 Ajax格式前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

异步 Ajax格式:1
$.ajax({
url:url,
type:"GET",
data:data,
success:function(data){
//alert(data);
var result=$(data).find("result").text();

if(parseInt(result)==0){
var dia = $(data).find("dia").text();
var con = $(data).find("com").text();
var dtime = $(data).find("dtime").text();

$("div#dloginfo div#content").html(con);
$("div#dloginfo div div#time").html("时间:"+dtime);
}
},
error:function(data){
alert("操作失败!!");
}
});

$.ajax({
type: "POST",
url: "/ajax_do_something.PHP",
data: "items=" + selectedItems.join('|'),或者//data: "{username:'" + username + "',pwd:'" + pwd + "'}",
dataType: "text",
success: function (request) {
document.location.reload();
},
error: function(request,error){
alert('Error deleting item(s),try again later.');
}
}
);[/b]

2:

function select_goods_table(strockId){ $.post("${pageContext.request.contextPath}/stockcontrol/stockTable_selectStockProduct.action",{"rid":strockId},function(data){ eval("var mydata="+data); $("#physical_inventory_list").children().remove(); var str=""; var rids=""; $.each(mydata,function(i,item){ rids+=item.RID; str="<tr target='"+i+"' rel='"+item.RID+"' attr=\"{'RID':'"+item.RID+"','PRODUCT_NO':'"+item.PRODUCT_NO+"','PRODUCT_NAME':'"+item.PRODUCT_NAME+"','COMPANY':'"+item.COMPANY+"','SPECIFICATIONS':'"+item.SPECIFICATIONS+"','STOCK_NUMBER':'"+item.STOCK_NUMBER+"'}\" ondblclick='add_physical_stocklist(this);'>"+ "<td width='91'>"+item.PRODUCT_NO+"</td>"+ "<td width='91'>"+item.PRODUCT_NAME+"</td>"+ "<td width='28'>"+item.COMPANY+"</td>"+ "<td width='64'>"+item.SPECIFICATIONS+"</td>"+ "<td width='64'>"+item.STOCK_NUMBER+"</td>"+ "</tr>"; $(str).appendTo($("#physical_inventory_list")); //$("#physical_inventory_list").append(str).initUI(); }); }); }

原文链接:https://www.f2er.com/ajax/164561.html

猜你在找的Ajax相关文章