2

So im working with ajax and trying to load external javaScript and i just want to know if Im doing it right. So far what i have is this

      <script>
     $(document)live('pageInit, function(event){
       $.getScript("9829_edge.js") 
       $.getScript("9829_edgeActions.js")  
         });

        </script>

This is really my first attempt at loading script via javascript so i just want to know if I'm doing it right or not and if thats the right way to load multiple files.

0

1 Answer 1

3

You missed dot before live, also closing quotes of pageInit is missing and terminate each statement with semicolon.

$(document).live('pageInit', function(event){
      $.getScript("9829_edge.js");
      $.getScript("9829_edgeActions.js");
});

jQuery live is deprecated so use on instead.

$(document).on('pageInit', function(event){
      $.getScript("9829_edge.js");
      $.getScript("9829_edgeActions.js");
});
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks @MCL, so nice of you.
No problem, sir. I'll be even nicer and recommend the use of a semicolon to end each statement.
well now im getting a syntax error in dreamweaver when i put that in. What Im trying to do is work around using this prebuilt loader that only works when the document is loaded, not live here it is in jsFiddle jsfiddle.net/yVLwD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.