defunkt / jquery-pjax

pushState + ajax = pjax
https://pjax.herokuapp.com
MIT License
16.73k stars 1.97k forks source link

i use $.pjax({url: url, container: '#pjax-container'}) but reload full page #651

Closed ysysdzz closed 7 years ago

ysysdzz commented 8 years ago
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=gbk">

    <script type="text/javascript" src="jquery-1.9.1.js"></script>
    <script type="text/javascript" src="jquery.pjax.update.js"></script>
    <script type="text/javascript">
        $(document).pjax('a[data-pjax]', '.container', {
            maxCacheLength:0,
            cache: false,
            fragment: ".container",
            timeout: 8000
        });
        $(function () {
            $('.container').delegate('#redbtn', 'click', function () {
                $.pjax({url: 'demo2.html', container: '.container'})
            })
        });
    </script>
</head>
<body>
<div class="content">
    <a href="demo1.html" data-pjax>demo1</a>
    <a href="demo.html" data-pjax>demo</a>
    <img src="abc.jpg"/>
    <div class="container">
        <button type="button" id="redbtn">redirect (BUG full page reload)</button>
        hello1111111111111111111111
    </div>
</div>
</body>

when i click that button full page reload why?

mislav commented 7 years ago

Sorry, there is not enough information given here for us to be able to provide any advice. It sounds like this might be a problem with usage of this project, and not a bug in our code. If you do think this is a bug, please reopen this and provide more information. Thank you!