I have a form that displays a number of results based on the value of a select list "#maxrows" (25, 50, 125, 250 results). "#startID" is a hidden input thats value is set to 1 that starts the displayed data from the first one. So each time you click "#next/#prev" it adds or subtracts from its value. Through PHP i display two buttons #previous and #next when the info is returned on the page via AJAX. Is there a better way to step through the results than this?
$(document).ready(function() {
$("#processing").hide();
var options = {
target: '#return',
beforeSend: function() {
$('#processing').show()
},
complete: function() {
$('#processing').hide()
}
};
$('#SymbolSearchForm').ajaxForm(options);
});
function changestart(direction)
{
var rowsElement = $("#maxrows");
var rowsValue = parseInt(rowsElement.val());
var startElement = $("#startID");
var value = parseInt(startElement.val());
startElement.val(direction == "forward" ? value + rowsValue : direction == "back" ?
value - rowsValue : 1);
}
"#processing" is just the loading gif, im more concerned with the "function changestart(direction)" part