Linking internally - does not fetch AJAX driven content


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 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 :slight_smile:

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?

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.

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.

Yep I know :slight_smile:

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? :slight_smile:

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.

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 :slight_smile:

No, I don’t have time to do that tonight, but perhaps someone will come up with the code for you.