1. 程式人生 > >從onclick到function到ajax的url問號傳多個引數(更多的話以此類推)問題

從onclick到function到ajax的url問號傳多個引數(更多的話以此類推)問題

廢話不多直接上程式碼

  • onclick
<a class="blue" onclick="changeUse('${use.device_code}','${use.device_use }');" href="javascript:void(0)" data-rel="tooltip" title="裝置狀態">
  • function和ajax的url問號傳值到後臺
            function changeUse(device_code,device_use){
                bootbox.confirm("確定要更改裝置狀態嗎?
    ", function(result) { if(result) { $.ajax({ url:"${ctx}/deviceUse/changeUse.do?device_code="+device_code+"&device_use="+device_use, type:"post", dataType:"text", success:function(){ nextPage(${page.currentPage}); }, error:function(){ $.messager.alert(
    '警告','更改失敗'); } }) } }); }