With javascript how can I add a query string parameter to the url if not present or if it present, update the current value? I am using jquery for my client side development
By using jQuery we can do like below
jQuery
var query_object = $.query_string; query_object["KEY"] = "VALUE"; var new_url = window.location.pathname + '?'+$.param(query_object)
In variable new_url we will have new query parameters.
new_url
Reference: http://api.jquery.com/jquery.param/