0

I am trying to create a button in header for showing next page.

<a href="#test" data-theme="b" data-rel="next" data-role="button">Next</a> 

there is a data-role=page div having id#test, but when I click on next btn it shows something like this in url

/index.html#home&ui-state=dialog

and no page is opening, although I can open that page by entering manually in browser url bar #test at the end.

coure2011
  • 40,286
  • 83
  • 216
  • 349

1 Answers1

0

This should help you: AJAX Request Help for next/previous page

Live Example: http://jsfiddle.net/Jaybles/MawSB/

var currentPage=1; loadCurrentPage();

$("#next, #prev").click(function(){
    currentPage= ($(this).attr('id')=='next') ? currentPage + 1 : currentPage - 1;

    if (currentPage==0) 
        currentPage=1;
    else if (currentPage==101) 
        currentPage=100;
    else
        loadCurrentPage();
});

function loadCurrentPage(){
    $('input').attr('disabled','disabled');
    $('#displayResults').html('<img src="http://blog-well.com/wp-content/uploads/2007/06/indicator-big-2.gif" />');

    $.ajax({
        url: '/echo/html/',
        data: 'html=Current Page: ' + currentPage+'&delay=1',
        type: 'POST',
        success: function (data) {
            $('input').attr('disabled','');
            $('#displayResults').html(data);
        }
    });
}

Html

<input id="next" type="button" value="Next" />
<input id="prev" type="button" value="Previous" /> 
<div id="displayResults" name="displayResults"></div>
Community
  • 1
  • 1
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383