2010-07-26 31 views
1

看到錯誤: http://jsfiddle.net/sEdGz/2/腳本工作,但點擊電臺不檢查=檢查jQuery的AJAX POST

//劇本作品,但單擊的單選不檢查=檢查 // MySQL的和PHP做工不錯

$('#form1').live("click change", function() { .... 
<div class='divtoclick'>neu berechnen</div> 
<form id="form1" method="post" name="bestellformular"> 

<input value="101" name="flyer_anzahl" type="radio" /> 1.000 
<input name="flyer_anzahl" type="radio" value="102" checked="checked"/> 
... 

我想要得到這樣的:

$('#form1').find('.divtoclick').live("click", ..... 
$('input#form1').live("change", ..... 

任何人可以幫助我嗎? thx

回答

1

原因是你的return false

這將工作:

$('#form1').live("click change", function() { 
     $.ajax({ 
     type : "POST", 
     cache : false, 
     url  : "berechnung_ajax.php", 
     data : $(this).serializeArray(), 
     success : function(data) { 
         $('#berechnung').html(data); 
     }}); 

    return true; // return true in order not to prevent the event 
    });  
});