views:

65

answers:

1

Hi guys,

I'm trying to build some jquery tabs based on the request (which is stored in a table).

I have two pages sharing one .js file. One page is for the user to create the request, and the other is for the administrator to approve/deny the request.

On the admin page, here is my javascript code:

    $(function() {
        GetRequest();
    });

Which is just calling a function I have inside my .js file.

All the code in the .js file is also wrapped in a '$(function(){ //...code here })'.

The problem is the function isn't built yet when calling it from the page. Is there a way I can tell the page to wait until the script is complete?

+2  A: 

Don't wrap the code inside the .js file in the $(function(){ ... }) code. It puts the function inside of an instance that you can't access outside of that ready function. Then on both the admin and user page, call the appropriate functions inside the .js file

fudgey