Home
Web CMS (TeamSite)
how to call component with ajax
jateen
Hi All,
i have a component thats have two taps name is component1 and component2 when we click component1 tab then call first component and when we click component2 tab then call second component with ajax based .
please help me how we can do this work .
Find more posts tagged with
Comments
Rick Poulin
I'm guessing you're asking about $AJAX_URL and Iwov's AJAX mechanism? I never did quite figure that out myself because the documentation is non-existent and the one example they provide is terrible. However, I do know for sure that you can't "replace" one component for another the way you're talking about it, at least not with ootb stuff. The way it's meant to work is that your component can call *itself* to change *its own* content at display time. This means that you'd have to have the content for both tabs captured in a single component, no matter how you decide to build the dynamic part.
Personally, I think you'd best capture the content for both tabs in the component, show it in different divs with one initially on display:none, and then use very simple javascript to show/hide the right tabs onclick. Remember that for SEO, you should print all content on the page even if it's hidden, otherwise search engines will never find it. Consider also building this as a progressive enhancement, i.e. your tabs render one above the other until (and if) javascript kicks in to make them tabs in a single box.
BTW, there's tons of front-end frameworks that could help you with this... ExtJS, JQuery UI, Dojo, etc..
And slipping in a personal opinion, you didn't give any context for what you're building... but Progressive Enhancement should be done on websites for accessibility and SEO reasons. AJAX is best left for web applications and portals, which LiveSite decidedly is not. Your requirement sounds like it could be implemented just fine with PE without going down the AJAX road.