Is there a built-in function in JavaScript or the JSON object to convert a JSON object to URL form like: "parameter=12&asd=1"?
This is how I have achieved it:
var data = {
'action':'actualiza_resultado',
'postID': 1,
'gl': 2,
'gl2' : 3
};
var string_=JSON.stringify(data);
string_=string_.replace(/{/g, "");
string_=string_.replace(/}/g, "");
string_=string_.replace(/:/g, "=")
string_=string_.replace(/,/g, "&");
string_=string_.replace(/"/g, "");
But I am curious if there is a more efficient way to achieve this using native JavaScript or JSON functions.