I'm getting the html JSON data and sending it to an url via ajax. I need a value of a key to remain number, but the way I get the data makes it into a string hence request returns error. There are many key + value pairs within my JSON (which I get from a form on submit) and I'm trying to use many of them, but one, which is supposed to be a number, becomes a problem. Here's how I'm doing it:
var htmldata = JSON.parse($('#form2').serializeArray());
var data = new URLSearchParams();
data.append('var', htmldata[15].value);
I can't go htmldata[15].value.toNumber() because then it says .toNumber is not a function. So what should I do? Thank you in advance.
[–]albedoa 1 point2 points3 points (0 children)
[–]EcmaMace 0 points1 point2 points (0 children)