Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question performing ajax funtion on page(body) upload event

    hi guys
    i hope u all r doing well... i have a problem ,, i wanna ask that is it possible to perform an ajax function when page is uploded... i.e ajax function perform automatically when a page is load... (on body's upload even)???? if so plz tell me how to do it
    regards

  • #2
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    Although this is not a php question, you should be able to use something like

    Code:
    <script type="text/javascript">
    window.onload = function()
    {
       ajaxFunctionHere();
    }
    </script>
    PHP Code:
    $aString is_string((string)array()) ? true false// true :D 
    [/CENTER]

  • #3
    Regular Coder funnymoney's Avatar
    Join Date
    Aug 2007
    Posts
    364
    Thanks
    17
    Thanked 24 Times in 24 Posts
    if that doesn't work you can try this

    PHP Code:
    <body onload="ajaxfunctionhere()"

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    I find with ajax it's better to put the tag at the bottom of the page if you need something to trigger on load, this way you can be sure that all the other page elements are indeed loaded.

    just drop it at the end if your script like
    Code:
    <script>ajaxfunctionhere();</script>


  •  

    Posting Permissions

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