I have a link, and when a user clicks it, it pushes a javascript file onto the page. in addition to that, it adds on parameters to the javascript src example:
<script type="text/javascript" src="javascripfile.js?r=some%values&u=more&values">
This isn't getting passed through URL on browser. I was wondering how I would get these parameters inside javascriptfile.js?
javascriptfile.js:
(function(){
//how to get r value, u value?
}());
Thanks for your help!
Please try this: http://jsfiddle.net/9Mvxb/ or http://jsfiddle.net/mKNPT/1/ And http://jsfiddle.net/mKNPT/3/
Please note if you are not comfortable using
class
see this Demo: http://jsfiddle.net/24UdH/API: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/indexOf
further in case you wondering about
val.indexOf("?") + 1
why+1
it is to avid?
This should help,
:)
code
OR
tag