2012-03-06 193 views
0

我有一個簡單的jQuery功能在這裏:瘋狂jQuery的Ajax錯誤

function submit_selection(del,submit) 
{ 
    del='yes'; 
    submit=true; 
    var ITAMZ=new Array(); 
    var count=0; 
    if (submit) 
     $('input[group="Blaaa"]:checked').each (function(){ 
      ITAMZ[count]=$(this).attr('name'); 
      count+=1; 
     }); 
    $('#s_o_s_r').html('Submitting...'); 
    $.ajax({ 
     url: "script/order_select_submit.php", 
     context: document.body, 
     success: function(data){ 
     $('#s_o_s_r').html(data); 
     }, 
     error: function() 
     { 
     $('#s_o_s_r').html('error submitting'); 
     }, 
     async:true, 
     type: "POST", 
     data: {'ITAMZ' : ITAMZ, 'delete': del}, 
     dataType: "html" 
    }); 
} 

我發誓,上帝,假如我這樣從A HREF觸發它:

$('#remove_sel').click(function(){ 
    submit_selection('yes',true); 
}); 

它總是返回一個錯誤,但如果我從這樣的按鈕觸發它:

$('input.client_btn').click(function(){ 
var shiiit=$(this).attr('name'); 
    if (shiiit=='all') document.location.href="order_price.php?show=all"; 
    else if (shiiit=='selected') { 
     ///document.location.href="order_price.php?show=selected"; 
     submit_selection('yes',true); 
     } 
    else document.location.href="order_price.php"; 
}); 

它總是觸發成功。 這是可笑的,我只是不明白。 Plase help ... Q. &

+0

任何想法?..... – Anonymous 2012-03-06 08:11:43

+0

什麼是錯誤? – 2012-03-06 08:12:42

+0

嘗試使用提琴手和調試。你會知道錯誤信息。 – dhinesh 2012-03-06 08:15:45

回答

0

我放棄了一個href,並使用了一個SPAN。這是問題與JavaScript無效(0)