I have a function that loads more database results. This function is called on different pages so i have given its own file and then linked to it in each of those pages e.g.:
<script type="text/javascript" src="js/loadmorebuilds.js">
</script>
In that file, i run an ajax call to a file and use a segment of the pages URL.
If i create that segment in the file itself it doesnt work as im guessing it uses the URL of the page. My work around currently is like so:
<script>
var exampleSegment = window.location;
</script>
<script type="text/javascript" src="js/loadmorebuilds.js">
</script>
However i am writing a longer method of getting that segment from the URL and want to include it in with the js file itself so i dont have to go editing it on every page that i need it.
Is there a way to do this? Thanks, hope it makes sense...