SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery AJAX equivalent to window.onload

    Does anyone know if there's an equivalent to window.onload that I can run in an AJAX call. I've got a script where I need to measure the width of the content to create a controller - unfortunately if the images haven't loaded the width is totally wrong.

    Any ideas?

    Cheers,

    Jon

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Try

    Code JavaScript:
    $(window).load(function(){
        // Ajax Code Here
    });

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That doesn't seem to work. When I added that it didn't execute the functions that it was supposed to.

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    The code i posted is the exact same thing as writing

    Code JavaScript:
    window.onload = function(){
         // Code Here
    }

    Try

    Code JavaScript:
    $(document).ready(function(){
        // Ajax Code Here
    });


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •