I have a radio button that gives Ajax request and feedback executed on click. The result is returned to success
variable ( true
or false
). What do I need to check radio only when AJAX succeeds but it is marked before Ajax.
$ ('input [type = "radio"]'). ('Click', function (e) {var success = callAjax (); if (! Success) e.preventDefault ();});
Upd.
The reason for using preventDefault is to check the previous radio button, not just uncheck the current.
$ ('input [type = "radio"]') .on ('click ', Function (e) {var success = callAjax (); if (! Success) {$ (this) .prop (' checked ', false);}});
Comments
Post a Comment