0

サーバーに 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);

 ?>

今、正確に何が起こっているのか..ループと電子メールが送信されている間に制御が入っている場合、firebugはステータスを「中止」と表示します。それ以外の場合は正常に動作しています...何が間違っているのですか.

前もって感謝します

4

2 に答える 2

0
 $.ajax({
    type: "POST",
    data: checkin_push,
    url: api_url + 'file.php?token=' + last_token + '&date=' + dated,
    ...

GET と POST の両方のパラメーターを送信しています。したがって、確認したいのはnull、どのパラメーターも取得していないということです。

file.php で、

tokenとのdate値を次のように取得してください。$_GET

&checkin_pushパラメータ値を次のように送信$_POST

また

送信されたすべてのパラメーター値を次のように取得します$_REQUEST

于 2013-05-24T12:18:08.353 に答える