早上/下午的伙计们。
写了一些jquery-ajax-shizz,有点卡住了。我已经完成了调用PHP文件的实际过程,它只是试图让页面上的HTML按照我希望的方式进行更改。我想去掉Ajax调用等中使用的ID为的,并将其替换为从PHP文件传递的HTML。代码如下…
$(".save_places").click(function() {
$.ajax({
url: "{/literal}{$sRootPath}{literal}system/ajax/fan_bus.php",
type: "POST",
data: ({id : this.getAttribute('id')}),
dataType: "html",
success: function(msg){
$(this).before(msg);
$(this).empty();
alert(msg);
}
});
return false;
});
HTML非常简单;
<p class="links">
<a href="#" class="save_places" id="bus_{$businesses.results[bus].id}_{$sMemberDetails.id}"><img src="{$sThemePath}images/save_places.png" alt="Save to My Places" /></a>
<a href="#"><img src="{$sThemePath}images/send_friend.png" alt="Send to a Friend" /></a>
</p>
成功函数中的所有内容都是实验性的代码混合,有什么帮助吗?
一如既往地感谢你。