小编Ðr *_*ade的帖子

SyntaxError:JSON.parse:JSON第1行第2列的意外字符

我需要将此div附加到另一个div,但它给了我这个错误:

SyntaxError:JSON.parse:JSON数据的第1行第2列的意外字符

这是我的javascript代码:

var str = {'message': message,'text': text};
$.ajax({
    type: "POST",
    url: "api/reply",
    data: str,
    dataType: "json",
    cache: false,
    success: function(response)
    {
        var respons = jQuery.parseJSON(response);
        var type = respons.status
        if (type == 'success') {
            $("<div></div>").html(respons.message).appendTo("#messages");
        }
        else
        {
            toastr.error(respons.message)
        }
    }
})
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery json

2
推荐指数
3
解决办法
2万
查看次数

标签 统计

ajax ×1

javascript ×1

jquery ×1

json ×1

php ×1