I’m sending a POST request via XMLHttpRequest
with data entered into an HTML form. The form without interference of JavaScript would submit its data encoded as
If you could use JQuery
, you'll simply call .serialize()
function on your form
object, like follow:
function getQueryString() {
var str = $( "form" ).serialize();
console.log(str);
}
$( "#cmdTest" ).on( "click", getQueryString );
Note: It also encode data for use it in url request
I hope it helps you, bye.