我有一个 ajaxpost 以 json 形式返回响应,我想显示消息
{ "TEXT" : "Please fix it. there might be otehr reason, and need to address it, or call, incorrect username/password-username/port?. " }
我怎样才能得到json的值?我使用了以下但消息未定义,获取 json 对象的其他方法是什么
var TEXT = text.resp;
我有一个 ajaxpost 以 json 形式返回响应,我想显示消息
{ "TEXT" : "Please fix it. there might be otehr reason, and need to address it, or call, incorrect username/password-username/port?. " }
我怎样才能得到json的值?我使用了以下但消息未定义,获取 json 对象的其他方法是什么
var TEXT = text.resp;
包括这个库和下面的代码来解析你的 json
var json = $.parseJSON(obj.responseText);
var msg = json.message;
你也可以试试下面的代码
var json = JSON.parse(obj.responseText);
var msg = json.message;
您应该尝试解析对象,然后使用 json["object"] 而不是点来访问它。