我正在尝试使用 jquery ajax 获取数据,一切正常,我得到了我想要的,但我无法显示它,因为我得到一个 Uncaught TypeError: Cannot read property 'display' of undefined。
这里是代码。任何想法?
/*
* 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;
});
}
这是数据的输出
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: anemail@gmail.com</li>
</ul>