user2238699
user2238699

Reputation:

Jquery getScript is not Working?

Dear Friends i used jquery for drop down menu with scroll bar js plugin. when i load script like.

<script src="js/jquery.dd.js"></script>

it working properly.

but when i try to load is not working.

$.getScript( "js/jquery.dd.js", function( data, textStatus, jqxhr ) {
    console.log( data ); // Data returned
    console.log( textStatus ); // Success
    console.log( jqxhr.status ); // 200
    console.log( "Load was performed." );
});

i try to load js file to runtime but is not working. please help. Thanks.

Upvotes: 1

Views: 16243

Answers (1)

Rohan Kumar
Rohan Kumar

Reputation: 40639

May your Scripts are not sequenced try this,

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
    $(function(){
        $.getScript( "js/jquery.dd.js", function( data, textStatus, jqxhr ) {
            console.log( data ); // Data returned
            console.log( textStatus ); // Success
            console.log( jqxhr.status ); // 200
            console.log( "Load was performed." );
        });
    });
</script>

Demo may help you

Upvotes: 4

Related Questions