jqueryajax传递参数为数值时配置

xiaoxiao2021-02-28  82

function  _functionservicecontentsave(projectid){ var datas=[];  $("[name='servercheck']").each(function(){ if(($(this).is(":checked")==true)){ datas.push($(this).val()); } }); $.ajax({   url:requestContextPath()+"prj-budget/servicecontent/save", dataType: "json",  traditional: true, //传送数组值 type: "POST", data:{"datas":datas,  "projectid":projectid}, success: function (data) {    if(data.closeCurrent){                _functionlayeralert(data.message,1,functioniframerefresh);    } } });

}

traditional  类型:Boolean 如果你想要用传统的方式来序列化数据,那么就设置为 true。所以如果要将数据作为参数传递时要设置为true。默认情况是false是不能传递数组。

转载请注明原文地址: https://www.6miu.com/read-28163.html

最新回复(0)