这是我的 jquery 代码:
<tr>
<td>
<form name="group" id="form1" method="post">
<select name="group" id="group">
<option value="" disabled selected>Choose your group..</option>
<?php foreach ($userGroups['data'] as $groups) {
echo "<option value=\"".$groups['id']."\">".$groups['name']."</option>";
}?>
</select>
</form>
</td>
</tr>
<tr>
<td id="fetchmember">
<script type="text/javascript">
$('#group').on('change',function(){
var id_group = this.value;
$('#fetchmember').html('<center><img src="ajax-loader.gif"></center>');
$('#fetchmember').load('fetchmember.php?group='+id_group);
});
</script>
</td>
</tr>
fetchmember.php:
<?php
include 'facebookauth.php';
$groupId = $_GET['group'];
$groupmember = $facebook->api('/'.$groupId.'/members');
$membergroup = $groupmember['data'];
foreach ($membergroup as $membergroups) {
echo "<li>".$membergroups['name']."</li>";
}
?>
如何在纯 JavaScript 中创建 .load?我必须将我所有的 jquery 代码转换为纯 javascript 代码,但我不知道fetchmember.php?group='+id_group
用纯 javascript 加载。任何人都可以给我建议吗?
太感谢了