开发者

script works, but the clicked radio isn't checked=checked jquery ajax POST

开发者 https://www.devze.com 2023-01-09 01:39 出处:网络
to see the error: http://jsfiddle.net/sEdGz/2/ //the script works, but the clicked radio isn\'t checked=checked

to see the error: http://jsfiddle.net/sEdGz/2/

//the script works, but the clicked radio isn't checked=checked //mysql and php works good

$('#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"/>
... 

I want to get this:

$('#form1').find('.div开发者_运维技巧toclick').live("click", .....
$('input#form1').live("change", .....

Can anybody help me? thx


The reason is your return false.

This will work:

$('#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
    });    
});
0

精彩评论

暂无评论...
验证码 换一张
取 消