Tôi đang cố gắng kích hoạt XMLHttpRequest
tới mongoDB để truy xuất tài liệu qua AJAX.Yêu cầu REST AJAX đến mongoDB
Đây là mã của tôi:
function getJsonDocumentByModeldid(model_id) {
var valoreInput = document.getElementById('inputModelId').value;
alert(valoreInput);
$.ajax({
url: "http://localhost:28017/test/",
type: "get",
//data: "filter_a=" + valoreInput,
dataType: 'jsonp',
crossDomain: true,
success: function (data) {
alert("success");
//var json2javascript = $.parseJSON(data);
manageLayout();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus + " Error:" + errorThrown);
}
});
}
chức năng của tôi luôn luôn trả về một lỗi. Vì vậy, vấn đề là gì?
lỗi là gì? – andyb
yêu cầu ajax không thành công với tập lệnh, thay vào đó nếu tôi sao chép url trong trình duyệt, phản hồi của máy chủ với thành công. tôi không biết vấn đề là gì ... – ilamaiolo
Lỗi cảnh báo là Jqueryxxxxxx không được gọi! – ilamaiolo