4

i just want to know if its possible to retrrive param from js calling with passed values like this

myfile.js?my_parm=brol

My goal is to retrieve the my_param value from within my "myfile.js"

Thanks in advance

Mike Fielden
  • 10,055
  • 14
  • 59
  • 99
  • possible duplicate of [Get query string values in JavaScript](http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript) – Fosco Jun 09 '11 at 19:25

2 Answers2

1

See Calling URL parameters within a .js file

Community
  • 1
  • 1
Cesar
  • 3,519
  • 2
  • 29
  • 43
0

No, not from within the JavaScript, the only way to access query string parameters in JavaScript is through the document or location objects. Those are only available when the script is executed within the browser.

If you are trying to access it using a templating language (like php or python) you could of course capture the querystring argument and inject information into the JavaScript code with that.

Gabriel
  • 18,322
  • 2
  • 37
  • 44