SyntaxError: identifier starts immediately after numeric literal錯誤解決辦法


今天在項目中 用ajax跳轉並在url中傳數據時遇到了一個語法錯誤

function save(flag,checkFlag){
        $('#allInfoForm').ajaxSubmit({
            dataType : 'json',
            type : "post",
            data:{"operationFlag":flag,"checkFlag":checkFlag,"applicationId":'$!applicationId'},
            success : function(data) {
                if (data.success) {
                    Dialog.message(data.message,"提示", function() {
                     self.location.href=contextPath+"/intopieces/applyintopiecewait/change.page?applicationId="+'$!applicationId'+"&customerId="+'$!customerId'+"&applyQuota="+'$!applyQuota'+"&serialNumber="+'$!serialNumber';
                     });
                } else {
                    Dialog.message(data.message);
                    return false;
                }
            },
            error : function(data) {
                Dialog.closeLoad();
                Dialog.message("操作失敗");
                return false;
            }
        });
    }

SyntaxError: identifier starts immediately after numeric literal

參數的值為:

applicationId 402881e74a384553014a385826a70003
applyQuota 1000
customerId 0000000049bb6a710149bb872c1d0007
serialNumber 402881e74a384553014a385882e5000d

解決辦法:

?applicationId="+'$!applicationId'+"&customerId="+'$!customerId'+"&applyQuota="+'$!applyQuota'+"&serialNumber="+'$!serialNumber';

拼接時 把要傳的數據用''括起來 即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM