title: Load content via AJAX in jQuery (CodeIgniter view)
body: <p>I found a nice example on how to use AJAX in jQuery at this link: 
  <a href="http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/" rel="nofollow">http://yensdesign.com/2008/12/how-to-load-content-via-ajax-in-jquery/</a></p>
  
  <p>I added contents from <code>index.html</code> file to my <code>view.php</code> file (I'm using CodeIgniter).</p>
  
  <p>Everything looks okay, but when you want to switch to another section, page content doesn't change (same content as before shows up).</p>
  
  <p>I think maybe there is a problem, for <code>menu.js</code> file to pass data to CodeIgniter <code>view.php</code> file?</p>
  
  <p>Could you give me any suggestions on how could I solve this problem? I hope this would be helpful for others too.</p>
  
  <p>Menu.js file:</p>
  
  <pre><code>$(document).ready(function(){
  //References
  var sections = $("#menu li");
  var loading = $("#loading");
  var content = $("#content");
  
  //Manage click events
  sections.click(function(){
      //show the loading bar
      showLoading();
      //load selected section
      switch(this.id){
          case "home":
              content.slideUp();
              content.load("sections.html #section_home", hideLoading);
              content.slideDown();
              break;
          case "news":
              content.slideUp();
              content.load("sections.html #section_news", hideLoading);
              content.slideDown();
              break;
          case "interviews":
              content.slideUp();
              content.load("sections.html #section_interviews", hideLoading);
              content.slideDown();
              break;
          case "external":
              content.slideUp();
              content.load("external.html", hideLoading);
              content.slideDown();
              break;
          default:
              //hide loading bar if there is no selected section
              hideLoading();
              break;
      }
  });
  
  //show loading bar
  function showLoading(){
      loading
          .css({visibility:"visible"})
          .css({opacity:"1"})
          .css({display:"block"})
      ;
  }
  //hide loading bar
  function hideLoading(){
      loading.fadeTo(1000, 0);
  };
  </code></pre>
  
  <p>});    </p>
  
  <p>Animations from javascript is working (loading/content/sections) , but the real content isn't loaded from html file.</p>
  
  <p>As I said it looks like this script can't load content to the view.php file (which is CodeIgniter 'view' file)</p>
  
  <p>Any help is highly appreciated.</p>