Mitul Dabhi
answered Nov 30 '-1 00:00
suppose url :: http://localhost/test/showprogress.php?action=testAction&type=json
console.log(window.location.search);// ?action=testAction&type=json
console.log(document.location.search);// ?action=testAction&type=json
search property give the query string for window.location and document.location
but it will not give query string for the SEO friendly URL
http://localhost/test/showprogress/testAction/json
window.location.search and document.location.search will return ""(empty)
but if have URL like ::
http://localhost/test/showprogress/testAction?json
console.log(window.location.search);// ?json
console.log(document.location.search);// ?json
window.location.search and document.location.search return part of URL after "?"
for URL : http://localhost/test/showprogress/testAction?type=json , window.location.search will return ?type=json
hope it clear