Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default Loading a link into a DIV

    Hey,

    I have a link on a web page where I would like it to load the linked page into a specific DIV on my site.

    Does anyone know how to do this? I assume some JS/AJAX will be involved but I wouldn't know where to start.

    Thanks
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  2. #2
    Join Date
    Jun 2008
    Location
    West midlands, Birmingham.
    Posts
    2,093
    Tokens
    219

    Latest Awards:


  3. #3
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    I tried it but it just refused to work :S
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  4. #4
    Join Date
    Jun 2008
    Location
    West midlands, Birmingham.
    Posts
    2,093
    Tokens
    219

    Latest Awards:

    Default

    show code that you did, should work so you must of did wrong

  5. #5
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Ok, I don't think I really need to show you the head code, I just copy pasta'd it into the head, but heres the link code..

    Code:
    <a href="javascript:ajaxpage(rootdomain+'/static/privacy.php', 'content');">privacy1</a>
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  6. #6
    Join Date
    Jun 2008
    Location
    West midlands, Birmingham.
    Posts
    2,093
    Tokens
    219

    Latest Awards:

    Default

    Did you name the div 'content' ?

    Quote Originally Posted by Recursion View Post
    Ok, I don't think I really need to show you the head code, I just copy pasta'd it into the head, but heres the link code..

    Code:
    <a href="javascript:ajaxpage(rootdomain+'/static/privacy.php', 'content');">privacy1</a>

  7. #7
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Quote Originally Posted by iDenning View Post
    Did you name the div 'content' ?
    Yes
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  8. #8
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    Use jQuery, it's much better than the other AJAX / Javascript effects classes IMO.

    http://jquery.com/

    Just include the script include, then do:
    Code:
    <a href="javascript:$('#div_id_here').load(rootdomain+'/static/privacy.php');">privacy1</a>
    More info about the jQuery load() function:
    http://api.jquery.com/load/

    Edit - Just a second note, with AJAX, the requested page has to be on the same domain/subdomain.

  9. #9
    Join Date
    Nov 2008
    Location
    Cambridge, UK
    Posts
    901
    Tokens
    100

    Default

    XMLHTTPRequest, job done.

  10. #10
    Join Date
    Aug 2006
    Posts
    1,426
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by MattFr View Post
    XMLHTTPRequest, job done.
    Way to explain clearly.



    sod the lot

Page 1 of 2 12 LastLast

Posting Permissions

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