1
的網址爲http://example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>
如何更新網頁內容,而無需刷新頁面的jQuery
有頁面上的一些內容:
<div><a href="http://example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1a">price </a></div>
<div> the content....</div>
如果我點擊的價格,內容將被安排根據價格與上升。
<div><a href="http://example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1d">price </a></div>
<div> the content....</div>
如果我點擊價格,內容將根據價格按降序排列。
現在,我想得到當訪客點擊price
文字時,排列的內容可以交換。默認狀態是升序。並且不刷新頁面。
我該怎麼辦?
只要確保爲您的內容div提供此答案建議的'content_div'的ID即可。 – davidethell
謝謝.. @runeveryday根據您的html匹配ids。 – Jayendra
Jayendra,我很抱歉,我仍然不知道該怎麼做。如果所有內容位於ID productListing,$(「#productListing」).load($('#a_price')。attr('href');則有兩個URL(&sort = 1d「>,&sort = 1a「>)怎麼寫呢?謝謝 – runeveryday