How to use jQuery.ajax for a long content file?

Discussion in 'jQuery' started by 123GoToAndPlay, Jun 12, 2008.

  1. #1
    Hi all,

    I am trying jQuery.ajax to load a dynamic .php file into a div. Depending on the div height i want buttons so you can "slide" throught the text/content

    so far i have
    
    //php file i like to load
    //content.php?category=help
    
    <script type="text/javascript">
          $(document).ready(function(){
       // Your code here
    $.get("content.php", { category: "help"}, function(data){
    	$("#textContent").html(data);
      } );
     });
    </script>
    <style type="text/css">
    #textContent {
    width: 400px;
    height: 300px;
    border: 1px solid black;
    text-align: left; 
    padding: 5px;
    overflow:auto;
    }
    </style>
    </head>
    <body>
    <div id="textContent"></div>
    </body>
    
    Code (markup):
    but now the content is bigger than the div and i don't know how to go from here, so i don't have a scroll but say button 1, button 2 and slide
     
    123GoToAndPlay, Jun 12, 2008 IP
  2. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hmm,

    
    <script type="text/javascript">
          $(document).ready(function(){
       // Your code here
    $.get("content.php", { category: "help"}, function(data){
    	$("div#textContent").html(data);
      } );
      $(".more").click(function(){ 
      alert("Slide down ");
      $('div#textContent').slideDown('slow');
      }) 
     
      //end code
     });
    </script>
    
    Code (markup):
    doesn't show the next page??

    something in the line of this
    
    <a class="more" href="#">1</a> | <a class="more" href="#">2</a> | <a class="more" href="#">3</a>
    
    Code (markup):
     
    123GoToAndPlay, Jun 12, 2008 IP
  3. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ttt,

    pagination with jQuery/ajax?
     
    123GoToAndPlay, Jun 14, 2008 IP