我正在向服务器发送 ajax 请求
$.ajax({
type: "POST",
data: checkin_push,
url: api_url + 'file.php?token=' + last_token + '&date=' + dated,
dataType: "json",
timeout: 100000, // 100 seconds
success: function(data) {
// invoke sync
api_pending_sync = true;
// checkin back to home
$.mobile.changePage('#home', { reverse: true });
//api_sync_message
$('#sync-message').fadeIn(300).html('<div class="ui-body ui-body-e ui-corner-all" style="margin-bottom: 20px;" data-theme="d">Successfully checked in for ' + checkin_display_date() + '.</div>').fadeOut(5000);
},
complete: function(jqXHR, textStatus) {
$.mobile.hidePageLoadingMsg();
},
error: function() {
$('#checkin-status-message').fadeIn(300).html('<div class="ui-body ui-body-e ui-corner-all" style="margin-bottom: 20px; color: red;" data-theme="d">Unable to Check In, Please check your internet connection and try again.</div>').fadeOut(5000);
}
});
这是file.php的相关代码
=========rest code -=================
#------------------- send alert to life lines (send alerts) -------------------
$query = query("SELECT email, phone, sms_carrier FROM table WHERE account_id = ".escape($account_id));
if ((mysqli_num_rows($query) > 0) and $send_alert)
{
while ($l = mysqli_fetch_assoc($lifelines))
{
// send mail
/* this function is returning value of mail() function*/
send_alert_email($userEmail, $sms_email, 'alert-2');
}
}
#-------------------------------(/alerts)--------------------------------------
$return = array('answers' => $answers); //, 'transact' => $checkin_transact);
}
json_out($return);
?>
现在到底发生了什么......如果控制进入while循环并且电子邮件正在发送,萤火虫显示状态为“中止”,否则它工作正常......我做错了什么......
提前致谢