function convert_amount() { $("#btn-convert").addClass("disabled"); $("#error-holder").hide(); $("#ok-holder").hide(); var d = new Date().getTime(); $.ajax({ url: "https://republicgrenada.com/rates/ajax/tools/convert?"+d, type: "POST", crossDomain: true, data: { amount: $("#amount-frm").val(), to: $("#to-frm").val(), from: $("#from-frm").val(), cash: ($("#cash-frm").prop("checked"))?1:0 }, dataType: "json", success: function(data) { $("#btn-convert").removeClass("disabled"); if (data.error) { $("#error-holder").removeClass("hidden"); $("#error-holder").show(); $("#error-message").html(data.error); } else { $("#ok-holder").removeClass("hidden"); $("#ok-holder").show(); $("#ok-message").html(data.human); } }, error: function (xhr, status) { alert("error"); } }); } $(document).ready(function(){ if(typeof $('.btn-group').button === 'function') { $('.btn-group').button(); } });