Php 如何通过jquery更新页面内容而不刷新页面

Php 如何通过jquery更新页面内容而不刷新页面,php,jquery,Php,Jquery,页面url为http://example.com/index.php?main_page=index&Path= 页面上有一些内容: <div><a href="http://example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1a">price </a></div> <div> the con

页面url为
http://example.com/index.php?main_page=index&Path=

页面上有一些内容:

<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
文本时,安排的内容可以交换。默认状态为升序。不要刷新页面

我该怎么做?

可以使用从url分配html,而无需重新加载页面。
单击价格链接,您可以加载内容div

e、 g

对于下面的html-

<a id="1d" href="example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1d">1d</a>
<a id="1a" href="example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1a">1a</a>
<div id="productListing" />
已将ID添加到链接中。可以使其成为通用的。 此外,链接内容应仅呈现部分内容以及需要显示的结果。

可用于从url分配html,而无需重新加载页面。
单击价格链接,您可以加载内容div

e、 g

对于下面的html-

<a id="1d" href="example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1d">1d</a>
<a id="1a" href="example.com/index.php?main_page=index&Path=<?php echo $_GET['Path'];?>&sort=1a">1a</a>
<div id="productListing" />
已将ID添加到链接中。可以使其成为通用的。
此外,链接内容应仅呈现部分内容,结果需要显示。

请确保将此答案建议的“content\u div”id提供给您的内容div。Jayendra,很抱歉,我仍然不知道如何操作。如果所有内容都在ID productListing中,$(“#productListing”).load($(“#a#price”).attr('href');有两个URL(请确保给您的内容div这个答案所建议的“content#div”ID。Jayendra,很抱歉,我仍然不知道如何做。如果所有内容都在ID productListing中,$(“#productListing”).load($($)(#a#price')).attr('href');有两个URL(
$('#1d, #1a').click(function(event){
    // Prevent default link behaviour
    event.preventDefault();
    // load the div contents from the link
    $('#producListing').load(this.attr('href'));
})