Specific error as shown in the figure below:
Said baidu for a long time not found several situation of undefined identifiers
1, the accident of punctuation (commas in Chinese quotes, etc.)
2, the value of type string without double quotes
Are revised check it again, and try to change the arrow function of the page to normal function, the $(document). Redeay (function () {}) to the window. The onl oad, but still won't do, have a few days all don't know what is the problem,
About the "result" my specific code is as follows:
//submit order dataThe function go_order2 () {
Let the result=[];
Let section=document. GetElementById (" section ");
Let the ids=section. GetElementsByClassName (' divclass order ');
For (the let I=0; I & lt; Ids. Length; I++) {
Let names=ids [I] getElementsByClassName (' name ');
Let countNum=ids [I] getElementsByClassName (' countNum ');
For (let j=0; J & lt; Names. Length; J++) {
Var num=countNum [j]. Journal of value;
Var name=names [j]. The innerText;
Let postID=names [j]. The title;
Result. Push ({
"PostID", postID,
"Quantity" : num
})
The console. The log (" result ", result);
}
}
Send_arr (result);
}
//get order data
The function send_arr (result) {
Let mallPhone=myStorage. The getItem (' mallPhone ');
//let data=https://bbs.csdn.net/topics/result.filter (item=> item. The quantity * 1> 0);//apple incompatible arrow function?
Let data=https://bbs.csdn.net/topics/result.filter (function (item) {
Return the item. The quantity * 1 & gt; 0
});
The console. The log (" send_arr ", result, data);
If (JSON. Stringify (data)! )='[]' {
$. Ajax ({
Type: "post",
Url: "API/add_order,"
Data: {
"Phone" : mallPhone,
"Record" : JSON. Stringify (data)
},
Traditional: true,
Success: the function (res) {
Var arr=JSON. Parse (res);
If (arr. MSG=='entry success') {
//alert (' school success);
Window. The location. Href="https://bbs.csdn.net/topics/sure_order.html? Data="+ arr. Data;
} else {
Alert (arr. MSG);
}
}
});
} else {
Alert (' please choose goods! ');
}
}