AJAX调用REST API返回NULL
各位大侠,小弟最近遇到一个难题,请各位不吝帮忙,先谢过,问题如下:我可以通过IE8浏览器调用以下API
# Request
GET https://www.
# Response
{
"date": "1410431279",
"ticker": {
"buy": "33.15",
"high": "34.15",
"last": "33.15",
"low": "32.05",
"sell": "33.16",
"vol": "10532696.39199642"
}
}
这个API还有以下的说明:All requests go over https protocol, The field 'contentType' in request header should be: 'application/x-www-form-urlencoded'. The root url is: https://www.
然后我在JS中想通过AJAX调用,缺发现跳出的信息窗是"用户名:null",源代码如下:
<script src="Js/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#btnSave").click(
function () {
$.ajax({
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
url: "https://www.,
success: function (data) {
alert("用户名:" + data);
},
error: function (error) {
alert("出错:" + error.responseText);
}
});
}
);
})
</script>