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';

拼接时 把要传的数据用''括起来 即可。
posted @ 2014-12-12 11:12  JanWilliem  阅读(11140)  评论(0编辑  收藏  举报