How do I use AJAX to get the Next/Previous Page(s).
How to call in a browser:
page.php?page=1-1
or
page.php?page=1
The return is just text.
Should load pages in this format:
1-1
or
1
When the user clicks the next/previous page button(s) how do I pass that page number to the ajax call and display the results.
Also how do I keep track of what page the user is currently viewing?
And how do I put a max min for pages, like I have 100 pages don't make call for page 101
http://jsfiddle.net/2b8gR/5/
HTML
<input id="loadPages" name="loadPages" type="button" value="Next" />
<input id="loadPages" name="loadPages" type="button" value="Previous" />
<div id="displayResults" name="displayResults">
</div>
JS (This is not working)
$("#loadPages").click(function(){
$.ajax({
url: 'page.php',
data:{'page': '1-1'},
error : function (){ alert('Error'); },
success: function (returnData) {
alert(returnData);
$('#displayResults').append(returnData);
}
});
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…