SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linking internally - does not fetch AJAX driven content

    Hi

    Hope Iīve come to the right place, but this Iīm farely sure about; AJAX and java are pretty closely related...

    Anyhow, got a site here at http://openeye-design.com/beta2/ where I chosen to use AJAX off course to prevent the whole site from loading but just the contentholder. However, for som reason I canīt figure out how to link internally.

    Would like to link to another tab content from the frontpage. This is of course is the be opened in the content div as it normally would. But no matter what i try the link just opens as plain text. So it doesnīt fetched my AJAX-driven content at all. Off course Iīm aware that a classic <a href> wonīt cut it here, but is there a jQuery script to be used?
    Nevermind that the content isnīt formatted yet, iīll get to that

    Chances are that this is pretty simple, but canīt find any information on this process. Even Google have let me down.

    Can somebody please help?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,719
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by monofon View Post
    Would like to link to another tab content from the frontpage. This is of course is the be opened in the content div as it normally would. But no matter what i try the link just opens as plain text. So it doesnīt fetched my AJAX-driven content at all.
    Can you modify the content of page2.html for example, so that it contains more than just plain text? That would help us to troubleshoot your situation.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok... Done!

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,719
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by monofon View Post
    Ok... Done!
    Thanks, that seems to work. Here's what I see.



    When you're developing ajax content, you may need to clear your cache to get the updated work.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep I know

    Any idea how to link to this page from another? Guess that would be called deeplinking...

    Since the URL doesnīt change, what the heck do you point to?

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,719
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by monofon View Post
    Yep I know

    Any idea how to link to this page from another? Guess that would be called deeplinking...

    Since the URL doesnīt change, what the heck do you point to?
    You will need to overtake the onclick event of links. If the link is a fragment identifier (such as "#products"), then that is an internal link that you'll need to specially handle.

    When the link is a fragment identifiers (typically used internally), you'll need to load the tab that applies to it, and when the tab has finished loading you can then go to the intended destination, by setting the location hash to that fragment identifer. Now that the target exists, the page should behave as it normally would.

    How do you know which tab that the link applies to? There are two ways.

    You can look for the fragment identifier in your cache, and if it's not there you can load up the remaining tabs that haven't been loaded to check them as well.
    Or, and this might be preferred, you can specify which tab the link belongs with, so that you can activate the tab and then set the location hash with the fragment identifier.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you supply med with an example code/syntax. Cause I understand what youīre saying, but given the fact that iīm not much of a scripter it would be ever so useful

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,719
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by monofon View Post
    can you supply med with an example code/syntax. Cause I understand what youīre saying, but given the fact that iīm not much of a scripter it would be ever so useful
    No, I don't have time to do that tonight, but perhaps someone will come up with the code for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

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
  •