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.

    评论

    报告相同问题?

    悬赏问题

    • ¥15 matlab处理脑电数据悬赏(时序图+预处理+频谱图)
    • ¥100 r语言多元回归模型怎么看表达式
    • ¥15 PMM 9010/30P
    • ¥15 pom文件依赖管理,未找到依赖
    • ¥15 现在后端返回给我一堆下载地址,都是一个视频切片后的,如何在uniapp安卓环境下将这些分片的视频下周并且合并成原始视频并下载到本地。
    • ¥15 Unity导出2D项目运行时图片变成马赛克
    • ¥15 关于communitytoolkit.mvvm的生成器得到的代码看起来没有被使用的问题
    • ¥15 matlab中此类型的变量不支持使用点进行索引
    • ¥15 咨询第六届工业互联网数据创新大赛原始数据
    • ¥15 Pycharm无法自动补全,识别第三方库函数接收的参数!