Like the title said,
.load()
function won't load javascript from called page.
Would be grateful for any tips.
It's basic Single paged interface.
here is the full code.
Try to use getScript
http://api.jquery.com/jQuery.getScript/
Load a JavaScript file from the server using a GET HTTP request, then execute it.
You can do it with getScript
:
$.getScript("url");
This is a shorthand Ajax function, which is equivalent to:
$.ajax({
url: url,
dataType: "script", // <===
success: success
});
getScript
docs
Based on the code in the edit:
var LoadContentWrapper = href+' .pageloader_inner';
$('#pageloader').delay(1000).queue(function() {
$(this).load(LoadContentWrapper, function() {
The url: href+' .pageloader_inner';
is invalid. you need to give the load
function a valid URL
This might be because you specified a page fragment to load and in that case scripts are stripped out
//Scripts executeds
$('#a').load('article.html');
//scripts stripped
$('#b').load('article.html #target');
From the docs
Script Execution
When calling .load() using a URL without a suffixed selector expression, the content is passed to .html() prior to scripts being removed. This executes the script blocks before they are discarded. If .load() is called with a selector expression appended to the URL, however, the scripts are stripped out prior to the DOM being updated, and thus are not executed. An example of both cases can be seen below: