SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: OnLoad

  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    724
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    OnLoad

    Hey,

    Can onload function grab get variable from the url passed?

    Code:
    window.onload = function() {
         AjaxRequest('main','./displaycontent.php?id=0');
    }

    Thanks

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by _matrix_ View Post
    Can onload function grab get variable from the url passed?
    Can you provide more details on the situation that you have, and what you want to achieve?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Location
    Central Florida
    Posts
    2,285
    Mentioned
    181 Post(s)
    Tagged
    4 Thread(s)
    This will probably give you what you need.
    But, as Paul mentioned, with a bit more detail of your *problem* the many skilled experts here could help you devise one or many solutions(s).
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)


    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains

  4. #4
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    724
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Erm how to explain it..

    I want to send a variable to the next page in the url.. On the page it is sent to I have an onload function (as above) to populate a div set by calling a php script into it using ajax.. The problem is that I cant capture the variable sent across the url to start with the correct record.. in which the data will then be paginated in the div using ajax for the page loads..

    Hope its making some sence

    Cheers

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by _matrix_ View Post
    I want to send a variable to the next page in the url.. On the page it is sent to I have an onload function (as above) to populate a div set by calling a php script into it using ajax.. The problem is that I cant capture the variable sent across the url to start with the correct record.. in which the data will then be paginated in the div using ajax for the page loads..
    Okay, you can use location.search to get the querystring, which in your situation may be "?id=12"

    Code javascript:
    AjaxRequest('main','./displaycontent.php' + location.search);
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    724
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh.. Sweet, thanks for that..


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
  •