0
我使用Wordpress作为内容管理系统,我的模板有一个带box
类的div,并且包含一个下拉列表。我的目标是获得与该值AJAX方法本droplist和查询后的值,然后重新用刚刚box
DIV阿贾克斯,为获得更清晰这里是标记:重新加载php页面的一部分而不刷新整个页面
<select>
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
</select>
------------------
<div class="content">
<?php
$args = array(
"meta_query" => array(
array(
'key' => 'meta',
'value' => '$select_value',
)
)
);
query_posts($args);
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p>sorry no post found with this value.</p>
<?php endif; ?>
我想示例代码是明确的,但我想这样做的过程:
用户选择dropdown list --> get select value --> put it in $select_value --> run query --> show the div box
项目无需重新加载使用AJAX整个页面...
谁能帮我出书面方式呢?
请点击这里http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/ – elclanrs
问题是什么?你只需要编写jQuery和Ajax和一个PHP函数来给你返回结果 – sven
我已经阅读了一些这样的帖子,不幸的是没有获得成功,你能给我一种方法解决这个问题,用我的代码编写? Thnx为您提供帮助。 –