$.post()提交表单,$.get() 异步刷新页面

xiaoxiao2021-02-28  113

$.post()  提交表单

$.post("url",$(this).closest('form').serializeArray(),function(data){ if(data.code==100){ //alert("提示: 申请成功"); }else if(data.code==110){ }else{ } },"json");

  $.get() 异步刷新页面

$.get("url",{},function(data){

if(data.code==100){ var dataStr=''; if(data.seller!=null && data.seller.length>0){ $('.bus-top-tb').children("li").remove();  //删除 li 标签

//$('.bus-top-tb').empty();

$.each(data.seller,function(i,s){  //动态添加 li 标签 ,通过$.each 遍历后台传来的 seller 集合 dataStr += '<li class=" ">' +'<div class=" ">' + s.nickName   +'</div>' +'<div  class=" ">' + s.amount+'件' +'</div>' +'<div class=" ">' +s.PayPrice + '元' +'</div>' +'<div class=" ">' +s.city +'</div>' +'</li>'; }); } $("#bus-top-tb").append(dataStr); //  加入到 ul 标签 } },'json');
转载请注明原文地址: https://www.6miu.com/read-84456.html

最新回复(0)