I've been developing my scripts in line and now want to start moving them to a js file. However, the first script I am moving will not work from the js file.
function listEvents(url, phash) {
var hashlocation = phash.split('#')[1];
if (hashlocation === undefined) {
var page = '';
} else {
var page = hashlocation;
}
$('#events').empty().load(url + page);
}
Called from page like so;
$(window).load(function() {
listEvents('<? echo base_url(); ?>ajax/events_ajax/',window.location.hash);
});
The js file is loaded after the jquery library in the head before anyone asks. I have cleared my cache, put cloudflare into dev mode etc, and if I load the JS file in my browser I see my function. I'm not seeing any errors in the console. What am I missing?