0

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?

1
  • I think we're going to need to see a little more of your code to figure out what your doing and what's going wrong :) also: functions don't need to go inside the $(function(){}) that's where you put any jquery or other javascript that you want to have called when the document loads. Commented May 7, 2010 at 16:16

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

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.