Tôi đang cố gắng lấy dữ liệu bằng cách sử dụng jquery ajax, mọi thứ hoạt động tốt và tôi có được những gì tôi muốn, nhưng tôi không thể hiển thị nó vì tôi nhận được Uncaught TypeError: Không thể đọc thuộc tính 'display' của undefined.jQuery UI: Uncaught TypeError: Không thể đọc thuộc tính 'display' của undefined
Ở đây mã. Bất kỳ ý tưởng?
/*
* Get the data from the ajax call and display a dialog
*/
function CreateDialog(email) {
// get the data from the ajax call
var promise = AjaxSubscribe(email)
// if data are available, show the dialog
promise.success(function (data) {
// data is a simple html code
var dialog = $(data);
// can't setup the dialog! Error
// Uncaught TypeError: Cannot read property 'display' of undefined
dialog.dialog({
autoOpen: false,
modal: true,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
});
dialog.dialog("open");
return false;
});
}
Đây là sản phẩm của dữ liệu
console.log(data)
<p>Data debugging</p>
<ul>
<li>Ip address: 193.125.139.18</li>
<li>Country Name: Italy</li>
<li>Country Code: IT</li>
<li>Email: [email protected]</li>
</ul>
Dữ liệu 'chứa' khi nào nó được trả về từ cuộc gọi ajax? – glomad
Vì lý do nào đó, tôi không nghĩ rằng 'dữ liệu' là những gì bạn nghĩ. 'console.log (dữ liệu)' và chia sẻ kết quả đầu ra! – tymeJV
Đã thêm dữ liệu đầu ra vào câu hỏi. Tất nhiên IP là giả mạo: D –