开发者

jquerymobile next page button

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 open开发者_如何学Pythoning, although I can open that page by entering manually in browser url bar #test at the end.


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜