monofon — 2012-05-31T03:34:24-04:00 — #1
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?
paul_wilkins — 2012-05-31T04:02:13-04:00 — #2
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.
monofon — 2012-05-31T04:51:09-04:00 — #3
paul_wilkins — 2012-05-31T04:57:22-04:00 — #4
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.
monofon — 2012-05-31T05:09:06-04:00 — #5
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?
paul_wilkins — 2012-05-31T05:13:07-04:00 — #6
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.
monofon — 2012-05-31T05:20:32-04:00 — #7
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
paul_wilkins — 2012-05-31T05:53:54-04:00 — #8
No, I don't have time to do that tonight, but perhaps someone will come up with the code for you.