2012-03-15 97 views
-2

調用此函數後,toDistance.php會運行嗎?它似乎對於距離.php沒有調用。由於

function myAjax(volunteerDist, jid){ 
      $.ajax({ 
      type:'POST', 
      url: 'toDistance.php', 
      data : ({ 
       distance:volunteerDist, 
       id:jid 
      }), 
      success: function(){ 
       alert('worked'); 
      }, 
       error :function(jqXHR, textStatus, errorThrown) { 
       alert(errorThrown); 
      }, 
      complete : function(){ 
       alert('thanks'); 
      } 
     }); 
+0

是它將運行 – Joe 2012-03-15 17:59:32

+0

@JoeTuskan在我toDistance.php,我有迴音,但它並沒有這樣做,怎麼來的? – 2012-03-15 18:00:46

+0

因爲它是ajax。不是頁面刷新。 – Joe 2012-03-15 18:01:11

回答

1

您是否嘗試過參與您的成功功能?試試這個代碼。

function myAjax(volunteerDist, jid){ 
      $.ajax({ 
      type:'POST', 
      url: 'toDistance.php', 
      success: function(data){ 
      ///CHECK UR UPCOMING DATA 
       alert(data.jid); 
       alert('worked'); 
      }, 
       error :function(jqXHR, textStatus, errorThrown) { 
       alert(errorThrown); 
      }, 
      complete : function(){ 
       alert('thanks'); 
      } 
     }); 
+0

或使用console.log() – jose 2012-03-15 18:03:09

+0

它說undefined ..這是什麼意思? – 2012-03-15 18:06:01

+0

打印'工作'之前輸出未定義?看起來像你的腳本沒有返回任何數據 – jose 2012-03-15 18:07:33

0

威爾toDistance.php調用此函數後跑了?

如果數據參數是服務器期望得到的,

使用firebug,檢查正在發生的事情與你的要求,並停止猜測...

0

似乎確定。嘗試使用FIddler跟蹤網絡流量,並檢查腳本是否被調用以及參數。

如果您使用Safari,Chrome或Firefox進行破壞,您可以記錄流量。 檢查POST變量,腳本位置等。