The URLSearchParams API is available in all modern browsers. For example:
const params = new URLSearchParams({
var1: "value",
var2: "value2",
arr: "foo",
});
console.log(params.toString());
//Prints "var1=value&var2=value2&arr=foo"
More Related Contents:
- Regular expression to get a string between two strings in Javascript
- Submit form without page reloading
- Submit two forms with one button
- Prevent double submission of forms in jQuery
- Regular Expression to get a string between parentheses in Javascript
- JavaScript Form Submit – Confirm or Cancel Submission Dialog Box
- Is there a way to create a function from a string with javascript?
- Replace multiple whitespaces with single whitespace in JavaScript string
- Why does “true” == true show false in JavaScript?
- GetElementByID – Multiple IDs
- Remove whitespace and line breaks between HTML elements using jQuery
- How can I use jQuery to style /parts/ of all instances of a specific word?
- Adding POST parameters before submit
- How can I insert new line/carriage returns into an element.textContent?
- how to use json file in html code
- How to get an input text value in JavaScript
- What’s the point of new String(“x”) in JavaScript?
- Get element by part of Name or ID
- javascript if number greater than number
- Form ‘onsubmit’ not getting called
- JavaScript adding a string to a number
- Extract the text out of HTML string using JavaScript
- submit event does not fire if submit initiated programmatically
- What is the difference between ‘ and ” in JavaScript?
- How best to make a link submit a form
- Is there an “after submit” jQuery option?
- jQuery asynchronous function call, no AJAX request
- Form Validation With Bootstrap (jQuery)
- how to get GET variable’s value in javascript? [duplicate]
- Does jQuery strip some html elements from a string when using .html()?