我一直在尝试连接到buqzilla api以获取与我的bug id相关的数据。我收到了响应代码200,在调试时显示解析器错误。我试图替换json格式的值但没有用。
CORS 还有另一个错误。
有人可以请帮助。谢谢。
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://jquery-json.googlecode.com/files/jquery.json-1.3.min.js"></script>
<script>
function Call() {
var requiredParameters = [{
"Bugzilla_login": "@@email@@",
"Bugzilla_password": "@@pwd@@",
"include_fields": "id"
}];
var connectionObject = {
params: JSON.stringify(requiredParameters)
};
var bugId = 19301;
var urlx = "http://engbugzilla:9898/" + "bug/" + bugId;
alert("here");
debugger;
$.ajax({
type: "GET",
async: true,
url: urlx,
contentType: "application/json",
dataType: "jsonp",
crossDomain: "true",
data: connectionObject,
success: function(data) {
alert("json");
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError);
console.log(thrownError);
}
});
}
Call();
</script>
</body>
</html>