Error: No conversion from text to json如何解决 执行ajax返回Error: No conversion from text to json错误,什么原因,如何解决? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 貌似返回的东西不能转换成json的样子 你把返回的东西发下看看 Error: No conversion from text to jsonOK{"success":"yes"}这样输出的error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);} ajax代码 $.ajax({ url: 'http://localhost/index.php', type: 'post', data: $('#div :input'), dataType: "json", success: function(data) { alert(data); }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); php代码:if($_SERVER['REQUEST_METHOD'] == 'POST') { $json = array(); if(isset($_POST['title'])){ $json['success'] = 'yes'; } else { $json['error'] = 'no'; } echo json_encode($json);} - -!随手打成等号了。contentType: "json" 求救,个人感觉很难的一个正则 JS 弹出框 "return在函数之外" 咋回事? 这是一段辑屏的代码,不错哦 java script 的问题 请问如何刷新框架中的另一个页面 怎样在modal窗口中进行頁面转換?在線等````急!!!!!!! 如何在javascript中实现对当前窗口的全屏和还原的控制,就象使用window.open("",null,"fullscreen =1")所打开的窗口一下? window.location? or document.location? JS添加多级菜单碰到问题了 jquery EXTJS 添加一条新行
Error: No conversion from text to json
OK
{"success":"yes"}
这样输出的
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
url: 'http://localhost/index.php',
type: 'post',
data: $('#div :input'),
dataType: "json",
success: function(data) {
alert(data);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
php代码:if($_SERVER['REQUEST_METHOD'] == 'POST') { $json = array();
if(isset($_POST['title'])){
$json['success'] = 'yes';
} else {
$json['error'] = 'no';
}
echo json_encode($json);
}
contentType: "json"