[wd_asp elements=’search’ ratio=’100%’ id=1]

Add a tick to button on result – Ajax

7th July 2016

Jquery - Ajax

jquery icon

On an ajax call, if your result is “Yes”, then it will swap classes and add a background of a tick in the button.
NTE: Not a fully working script.




After ajax post fromm the success part !


success: function(data){
$(".paymentchoice").html(data);

if (data == "Yearly") {
$('#addtoyear').text("Added To Yearly")
$('#addtomonth').text("Add To Monthly")
$('#addtomonth').removeClass('addtomonthnew');
$('#addtodep').addClass('addtodepnew');
}
else {
if (data=="Monthly") {
$('#addtomonth').text("Added To Monthly")
$('#addtodep').text("Add To Yearly")
$('#addtodep').removeClass('addtodepnew');
$('#addtomonth').addClass('addtomonthnew');

}
}
}