[英]jQuery .ajax call not returning data
I'm trying to update my HTML UI with data returned from a server running on an embedded system (means I have full control over what is returned). 我正在尝试使用从嵌入式系统上运行的服务器返回的数据更新HTML UI(这意味着我完全控制返回的内容)。 The data callback in the .ajax function never seems to be called however, why would this be?
但是似乎从未调用过.ajax函数中的数据回调,为什么会这样呢?
The jQuery code is jQuery代码是
$(document).ready(function() {
$('#pollGps').click(function() {
alert('calling /pollgps.json');
$.ajax({
url: '/pollgps.json',
dataType:'json',
success: function( data ) {
alert('success ' + JSON.stringify(data));
$("#settingId").html(data.settingId);
$("#settingValue").html(data.settingValue);
}
error: function(jqXHR, textStatus, errorThrown) {
alert('Error polling GPS ' + textStatus);
}
});
});
})
and the server response is 并且服务器响应是
HTTP/1.0 200 OK Content-Type: application/json { "settingId"="CFG-NAV2", "settingValue"="0xdead" }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.