jquery tabs with ajax content

jquery tabs with ajax content

Hello all,

I am a beginner in jquery. please clarify me on this doubt.

I am going to load dynamic content in tabs. in examples, i have seen that they have seperate php file for that content and assign that php files name on tab link. my question is, without having seperate php file, can i have the code inside the same page?

that is, say

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">tab1</a></li>
        <li><a href="#tabs-2">tab2</a></li>
        <li><a href="#tabs-3">tab3</a></li>
    </ul>

    <div id="tabs-1">
      <?php
            //here my dynamic content goes for tab1
      ?>
  </div>
<div id="tabs-2">
      <?php
            //here my dynamic content goes for tab2
      ?>
  </div>
<div id="tabs-3">
      <?php
            //here my dynamic content goes for tab3
      ?>
  </div>

is this is ok? is it the right way??

OR

Is it must to specify like the following?

      <li><a href="myfile1.php">tab1</a></li>
        <li><a href="myfile2.php">tab2</a></li>
        <li><a href="file3.php">tab3</a></li>

and have separate php files for each tab??


which one is good?

please help me..

Thanks for any help.