helloxielan 2014-10-08 23:44 采纳率: 0%
浏览 18

奇怪的$ .post行为

My function works with dynamic (ajax) content and looks like that. I clearly see on firebug that ajax query gets response from serverside. But $(".playlist-content").html(result); doesn't happen at all. Furthermore, I placed alert to test if function gets there. But neither before nor after $(".playlist-content").html(result); alert not happened.

$(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");
});

What am I doing wrong? Any suggestions?

  • 写回答

1条回答 默认 最新

  • weixin_33688840 2014-10-08 23:50
    关注

    The problem is, in your function You're using json as content type and your server returns html/text content. Remove json from your function and you're good to go.

    评论

报告相同问题?

悬赏问题

  • ¥30 电脑误删了手机的照片怎么恢复?
  • ¥15 (标签-python|关键词-char)
  • ¥15 python+selenium,在新增时弹出了一个输入框
  • ¥15 苹果验机结果的api接口哪里有??单次调用1毛钱及以下。
  • ¥20 学生成绩管理系统设计
  • ¥15 来一个cc穿盾脚本开发者
  • ¥15 CST2023安装报错
  • ¥15 使用diffusionbert生成文字 结果是PAD和UNK怎么办
  • ¥15 有人懂怎么做大模型的客服系统吗?卡住了卡住了
  • ¥20 firefly-rk3399上启动卡住了