這期內(nèi)容當中小編將會給大家?guī)碛嘘P(guān) pjax如何在jQuery中使用,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
目前創(chuàng)新互聯(lián)建站已為成百上千家的企業(yè)提供了網(wǎng)站建設、域名、虛擬空間、綿陽服務器托管、企業(yè)網(wǎng)站設計、秀英網(wǎng)站維護等服務,公司將堅持客戶導向、應用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
DEMO1:
客戶端:
<!DOCTYPE html> <html> <head> <title>pjax</title> <meta charset="utf-8"> </head> <body> <h2>My Site</h2> <div> Go to <a href="res1.php">第一頁</a>.<a href="res2.php">第二頁</a> </div> <div id="container"></div> </body> <script src="../jquery-2.1.4.min.js"></script> <script src="../jquery.pjax.js"></script> <script type="text/javascript"> $(document).pjax('a', '#container') </script> </html>
服務器端:
res1.php
<?php echo "<div style='background:red;'>第一頁</div>";
res2.php
<?php echo "<div style='background:red;'>第二頁</div>";
解釋:$(document).pjax('a', '#container')其中a是觸發(fā)元素,#container是裝載pjax返回內(nèi)容的容器,下面也是這樣。
DEMO2:
<!DOCTYPE html> <html> <head> <title>pjax</title> <meta charset="utf-8"> </head> <body> <h2>My Site</h2> <div> Go to <a href="res1.php">第一頁</a>.<a href="res2.php">第二頁</a> </div> <div id="container"></div> </body> <script src="../jquery-2.1.4.min.js"></script> <script src="../jquery.pjax.js"></script> <script type="text/javascript"> $(document).pjax('a', '#container') </script> </html>
客戶端:
<!DOCTYPE html> <html> <head> <title>pjax</title> <meta charset="utf-8"> </head> <body> <h2>My Site</h2> <div> <input type="button" id="clickMe" value="GO"> </div> <div id="container"></div> </body> <script src="../jquery-2.1.4.min.js"></script> <script src="../jquery.pjax.js"></script> <script type="text/javascript"> $(function(){ $('#clickMe').click(function(){ $.pjax({ url: './res3.php', container: '#container' }); }); }); </script> </html>
服務器端代碼:
res3.php:
<?php echo "<div style='background:red;'>第三頁</div>";
上述就是小編為大家分享的 pjax如何在jQuery中使用了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
分享題目:pjax如何在jQuery中使用
標題來源:http://jinyejixie.com/article30/gpsppo.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導航、微信小程序、網(wǎng)站改版、企業(yè)網(wǎng)站制作、網(wǎng)站制作、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)