我是 jQuery 的新手,并且已经正确地将 jQuery 库包含到我的 Wordpress 中,但是,似乎无法在我的 Wordpress 中执行 jQuery 调用,看不到任何结果。以下是我的代码片段:
/* In my html, initiate call when selecting a different member id */
<script type="text/javascript">
$(document).ready(function() {
$("#select_member_id").change(function() {
$.getJSON("<?php bloginfo('template_directory') ?>/get_member_info.php", {"member_id" : $(this).val()}, function(jMember,status) {
member = JSON.parse (jMember);
$("#member_firstname").text(member.first_name);
});
});
});
</script>
/* In get_member_info.php suppose to return a JSON result */
<?php
include("member_roster.php"); // this is just an array file
$member_id = $_GET["member_id"];
echo "{" . '"'.'first_name'.'"' . " : " . $member_roster[$member_id] ["first_name"] . "}";
?>
请告诉我我做错了什么......非常感谢!