Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Why jquery doesnt wok under cPanel modules ?

Discussion in 'User Experience' started by serverack, Feb 2, 2012.

  1. serverack

    serverack Member

    Joined:
    Aug 14, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    HI,
    I am developing a cpanel module, why jquery doesnt work ?
    I want to reload a specific <div> after some X seconds, well I have a script ready with me, it is as follows >>

    Code:
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
    <script>
    var auto_refresh = setInterval(
    function()
    {
    $('#listbackup').fadeOut('slow').load(tstep3.php').fadeIn("slow");
    }, 5000);
    </script>
    
    Below <div class="body-content"> I am using <div id="listbackup"></div>

    SO it looks like >>
    <div class="body-content">
    <div id="listbackup">
    </div>
    </div>



    How can I solve this issue ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    68
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    I use jquery all the time within cPanel. Have you loaded up a browser with a javascript console to check for errors?

    Try wrapping your code with a try catch to output errors to the console:


    Code:
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
    <script>
    try{
        var auto_refresh = setInterval(
        function()
        {
            $('#listbackup').fadeOut('slow').load(tstep3.php').fadeIn("slow");
        }, 5000);
    }catch(err){
       console.log('There was an error: ' + err);
    }
    </script>
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice