I'm trying to put together a code where script is run from another page based on the parameter, example:
Can anyone help me combine the two above please
- sitename.com/sitepage?script1 > This would run script in script1.php
- sitename.com/sitepage?script2 > This would run script in script2.php
- sitename.com/sitepage?script3 > This would run script in script3.php
- Etc (if nothing than run nothing)
Code:
<script>
$(document).ready(function () {
var scriptLocation = window.location.search.substring(1);
$(document.body).append($("script").attr(src,scriptLocation));
)}
</script>
<script type="text/javascript" src="[URL]http://mydomain.com/xxxx.js[/URL]"></script>
Can anyone help me combine the two above please
Last edited by a moderator: