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