defunkt / jquery-pjax

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

When using Pjax, the target page is returned without replace the container #728

Open xiaozhe19 opened 4 years ago

xiaozhe19 commented 4 years ago

I use Pjax like this 1.html

<div id="container">hello world</div>
<a data-left href="./2.php">Change</a>
 <script> 
        $(document).pjax('a[data-left]', '#container',);
</script>

2.php

<?
echo "<h2>Pjax succeed!</h1>"
?>

But it just switched to 2.php. How do I solve this problem