Last active
March 21, 2025 02:52
-
-
Save stemar/cd003e61d8e69fcf647b0662d9050b45 to your computer and use it in GitHub Desktop.
Create a http query string in ES6 JavaScript (no array in query string)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function http_query(data, arg_separator) { | |
| var query = []; | |
| for (var key in data) { | |
| query.push(encodeURIComponent(key) + "=" + encodeURIComponent(data[key].toString())); | |
| } | |
| return array.join(arg_separator || "&"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment