我有这个功能通过ajax打开对话框:
function gps(uid) {
$.ajax({
type: "POST",
url: "file.php",
data: {},
success: function (data) {
for(i=0;i<data.length;i++){
$('#gps').html("Data : "+data[i]['latitude']+"");
}
}
});
$('#gps').dialog('open');
return false;
}
如何在不关闭对话框的情况下每隔1秒动态更改已打开对话框的内容?
答案 0 :(得分:0)
setInterval( function()
{
gps(uid);
},1000);
var loading_progress = false;
function gps(uid) {
//stop queue callbacks
if ( loading_progress ) return;
loading_progress = true;
$.ajax({
type: "POST",
url: "file.php",
data: "data="+uid,
async: false,
cache: false,
success: function (data,status) {
if( ( status == "success") {
var i;
for(i=0;i<data.length;i++){
$('#gps').html("Data : "+data[i]['latitude']+"");
loading_progress = false;
}
}
});
$('#gps').dialog('open');
}