Programming Tips - jQuery: How to convert an object into a query string

Date: 2017nov14 Update: 2026jul13 Library: jQuery Language: javaScript Q. jQuery: How to convert an object into a query string A. Using jQuery.param(obj) like this:
const obj = { hello: 1, world: 'two' }; const qs = $.param(obj); console.log('qs is ' + qs);
Output (in the log):
qs is hello=1&world=two
Then you can use that as part of a URL (eg for AJAX)