JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 2nd, 2012, 11:55 AM
davidp994 davidp994 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 davidp994 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 33 sec
Reputation Power: 0
Navigation through records

hi, I am generating records through php/sql, as u can see the code displays 5 records, what Im trying to do is program so that when the next button is pressed the next 5 records will show?? any help much appreciated thank you,

the code -
Code:
    function show(qstring,qtype){
    $("#vsdiv").show();
    var myurl="scripts/searchpage.php";
    $.ajax({
    url: myurl, dataType:'json',data:{querystring:qstring,querytype:qtype},
    success: function(member){
    $("#results").append('<tr class="me">'+
    '<th>#REC</th><th>name</th><th>surname</th>');
    var j=0;var totrecs=1;
    for(var i=0;i<5;i++){
    $("#results").append('<tr class="rows'+j+'">'+
    '<td class="ids" id="z'+i+'">'+totrecs+'</td>'+
    '<td>'+name[i].bdate+'</td>'+
    '<td class="users" id="username'+i+'">'+member[i].username+'</td>'+
    '<td id="contact'+i+'">'+member[i].fname+' '+member[i].lname+'</td>'+
    '<td><input type="checkbox" name="whome" id="showMe'+i+'"'+
    'class="boxes" onclick="getMe('+i+')" /></td></tr>');
    totrecs++;
    j++;
    }
    }
    });
    }


and for the html button -
Code:
    <input type="button" id="next5" title="Next 5 Records" disabled="disabled" value="Next 5>>" />

Reply With Quote
  #2  
Old November 2nd, 2012, 12:03 PM
Winters Winters is offline
Super Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jul 2003
Posts: 3,871 Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 16 h 31 m 11 sec
Reputation Power: 2569
Welcome to DevShed, davidp.

A variable with an increment of 5 per click should do the trick. Where is the event function for the button?

Leaving work in 5 minutes, so someone else may need to reply.
__________________
[PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

W3Fools - A W3Schools Intervention.

Reply With Quote
  #3  
Old November 2nd, 2012, 12:09 PM
davidp994 davidp994 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 davidp994 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 33 sec
Reputation Power: 0
Thanks you, I dont yet have the event function for the button, any help with the code for the next button?? dont know how to start it

Reply With Quote
  #4  
Old November 2nd, 2012, 01:23 PM
jack13580 jack13580 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 143 jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level)jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level)jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level)jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level)jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level)jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level)jack13580 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 1 h 12 m 49 sec
Reputation Power: 75
you could easily do this in php using pagination and then using ajax so it doesn't reload the entire page every time the next or back button is clicked

Reply With Quote
  #5  
Old November 2nd, 2012, 02:28 PM
Winters Winters is offline
Super Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jul 2003
Posts: 3,871 Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 16 h 31 m 11 sec
Reputation Power: 2569
The script is already using jQuery's AJAX functions. So, you already have your JSON object you are sending to your server-side script. You just need to add a pagination number to it. Here is a pseudo-example to give you the concept.
Javascript Code:
Original - Javascript Code
  1. var recordCount = 0;
  2.  
  3. function show(args) {
  4.  
  5.     // existing code.
  6.  
  7.     dataType:'json',data:{querystring:qstring,querytype:qtype,rcount:recordCount}
  8.  
  9.     // existing code.
  10.  
  11.     recordCount += 5;
  12. }

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Navigation through records

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap