Reputation: 4933
I have this snippet of code:
var ShopLogicOptions = {};
ShopLogicOptions.params = {orderId: "'" + JS_OrderNo + "'", cartItems:[JS_arrCartItems], subTotal: "'" + JS_SubTotal + "'",...
How do I correctly put variable JS_OrderNo in the position it is at?
The other server is receiving this: "'9134832'",
And it should be this: '9134832',
EDIT: When I document.write JS_OrderNO it looks like this 9134832, so I have to add the single quotes.
Upvotes: 0
Views: 63
Reputation: 318638
Remove the quotes.
var ShopLogicOptions = {};
ShopLogicOptions.params = {
orderId: JS_OrderNo,
cartItems: [JS_arrCartItems],
subTotal: JS_SubTotal,
...
};
If you really need a string instead of a number, use this:
orderId: String(JS_OrderNo),
Upvotes: 3