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
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);
}
});
});
Error: Problem at line 11 character 1: Expected ')' and instead saw ''. } Problem at line 11 character 1: Missing semicolon. }
– Patrick Beardmoredata: 'page=1-1'
ordata:{'page': '1-1'}
– Dutchie432