奇怪的$.帖子行为
Strange $.post behaviour
我的函数处理动态(ajax)内容,看起来就是这样。我在firebug上清楚地看到ajax查询从服务器端得到响应。但是$(".playlist-content").html(result);
根本没有发生。此外,我放置了alert
来测试函数是否到达那里。但$(".playlist-content").html(result);
预警前后均未发生。
$(document).on("click", "#pl-edit", function (e) {
e.preventDefault();
var plid = $(this).data("plid");
$.post("/playlist/edit", {
plID: $(this).data("plid"),
op: "formRetrieve"
}, function(result) {
alert("here"); //for testing
$(".playlist-content").html(result);
alert("here"); //for testing
}, "json");
});
我做错了什么?有什么建议吗?
问题是,在您的函数中,您使用json作为内容类型,而您的服务器返回html/text内容。从你的功能中删除json
,你就可以开始了。
相关文章:
- 没有找到相关文章