Welcome Guest, Not a member yet? Register   Sign In
Ajax Tabs: Loading views into containers!! Possible?
#1

[eluser]danfloun[/eluser]
Hi,

I am wondering if I can use this Ajax tab script to work with my CI Project.
Basically all the Ajax script does is load the pages into the tab container.

Now obviously I am using model, containers and views and because of this my tab links will be written like <?php echo site_url('main/file_view'); ?> instead of simply file_view.php.

The rel="ajaxcontentarea" in lthe link simply loads the content of file_view into a container.

However this doesn't work and I'm wondering if it's actually possible to use this script this way! or with slight modification.

Tabs:
Code:
<ul id="maintab" class="shadetabs">
<li class="selected"><a href="#default" rel="ajaxcontentarea">Default Tab</a></li>
<li><a href="test.htm" rel="ajaxcontentarea">Test</a></li>
<li><a href="&lt;?php echo site_url('main/file_view'); ?&gt;" rel="ajaxcontentarea">File List</a></li>
</ul>

<div id="ajaxcontentarea" class="contentstyle">
<p>This is some default tab content, embedded directly inside this space and not via Ajax. It can be shown when no tabs are automatically selected, or associated with a certain tab, in this case, the first tab.</p>
<p><b><a href="[removed] expandtab('maintab', 2)">Select 3rd tab of "maintab"</a></b></p>
</div>


//Start Ajax tabs script for UL with id="maintab" Separate multiple ids each with a comma.
startajaxtabs("maintab")

Thanks

Danny
#2

[eluser]obiron2[/eluser]
the short answer is yes. The Ajax callback function needs to post the responseText into the innerHTML poperty of the container (you may want to sanitise it first). If you are calling the Ajax functions on the onLoad event you need to be aware of the Asyncrynous part of Ajax. If you make an Ajax call, your script will not wait for the response before moving on to the next line of the script. If you only use one ajax object you could overwrite the object properties and reset the update method before it has received and processed the response.

search the web for 'ultimate ajax object' to find a method of creating a specific ajax object for each ajax call. Some browsers apparently limit you to two ajax calls at a time.

obiron




Theme © iAndrew 2016 - Forum software by © MyBB