开发者

Trouble with loading jquery onload

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 .j开发者_开发问答s 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜