function submitResultDialog(result) { var successResultBtns= [ { text: "Show me the invoice", click: function() { redirectToStatement(); // $(this).dialog("close"); } } ]; var failResultBtns= [ { text: "Retry", click: function() { $('#CC_RETRY').val('TRUE'); if (typeof grecaptcha !== 'undefined') { grecaptcha.reset(); } $(this).dialog("close"); } } ]; var dialogTitle; $( "#RESULT_MESSAGE").css('background-color', 'white'); if (result['RESULT'] == 'SUCCESS') { $( "#error_result").hide(); $("#no_error_result").show(); $( "#dialog-result" ).dialog( "option", "buttons", successResultBtns ); $( "#RESULT_MESSAGE").html("Your order has been reserved. Thank you."); $("#Exh_hd_ID").val(result['COMPANY_ID']); $("#RESULT_COMPANY_ID").html(result['COMPANY_ID']); $("#RESULT_COMPANY_NAME").html($("#company").val()); $("#RESULT_PACKAGE_ID").html(result['PACKAGE_ID']); $("#RESULT_EMAIL").html($("#email").val()); $("#RESULT_SUB_TOTAL").html(result['SUB_TOTAL']); $("#RESULT_TAX1").html(result['TAX1']); $("#RESULT_TAX2").html(result['TAX2']); $("#RESULT_TOTAL").html(result['TOTAL']); $("#RESULT_AMOUNT_PAYED").html(result['AMOUNT_PAYED']); $("#RESULT_AMOUNT_DUE").html(result['AMOUNT_DUE']); $("#RESULT_ADD_SERV").html(result['ADD_SERV']); $("#RESULT_PAYMENT_METHOD").html(result['PAYMENT_METHOD']); $("#RESULT_TRANSACTION_DATE").html(result['TRANSACTION_DATE']); $("#RESULT_STATEMENT_ID").html(result['STATEMENT_ID']); //debugger; $("#RESULT_CC_AUTH_CODE").html(result['CC_TRANSACTION_DATA']['CC_AUTH_CODE']); dialogTitle ='Order Completed'; } else if (result['RESULT'] == 'ERROR') { $( "#error_result").show(); $("#no_error_result").hide(); $( "#error_title").html("System error"); $( "#error_message").html("An unexpected condition has occurred, please contact support 1-888-777-8613 ext. 11"); $( "#dialog-result" ).dialog( "option", "buttons", failResultBtns ); dialogTitle = "Submit Error"; } else if (result['RESULT'] == 'SERVER_ERROR') { $( "#error_result").show(); $("#no_error_result").hide(); $( "#error_title").html("Server Error"); $( "#error_message").html(result['ERROR_MESSAGE']); $( "#dialog-result" ).dialog( "option", "buttons", failResultBtns ); dialogTitle = "An error submitting has occurred please contact support 1-888-777-8613 ext. 11"; } else { // alert(result['RESULT'] ); $("#RESULT_COMPANY_ID").html(result['COMPANY_ID']); $("#RESULT_COMPANY_NAME").html($("#company").val()); $("#RESULT_PACKAGE_ID").html(result['PACKAGE_ID']); $("#RESULT_EMAIL").html($("#email").val()); $("#RESULT_SUB_TOTAL").html(result['SUB_TOTAL']); $("#RESULT_TAX1").html(result['TAX1']); $("#RESULT_TAX2").html(result['TAX2']); $("#RESULT_TOTAL").html(result['TOTAL']); $("#RESULT_AMOUNT_PAYED").html(result['AMOUNT_PAYED']); $("#RESULT_AMOUNT_DUE").html(result['AMOUNT_DUE']); $("#RESULT_ADD_SERV").html(result['ADD_SERV']); $("#RESULT_PAYMENT_METHOD").html(result['PAYMENT_METHOD']); $("#RESULT_TRANSACTION_DATE").html(result['TRANSACTION_DATE']); $("#RESULT_STATEMENT_ID").html(result['STATEMENT_ID']); //debugger; $("#RESULT_CC_AUTH_CODE").html(result['CC_TRANSACTION_DATA']['CC_AUTH_CODE']); $("#error_result").hide(); $("#no_error_result").show(); $( "#dialog-result" ).dialog( "option", "buttons", failResultBtns ); $( "#RESULT_MESSAGE").css('background-color', 'red'); $( "#RESULT_MESSAGE").html(result['CC_TRANSACTION_DATA']['CC_STATUS']); dialogTitle ='Payment Transaction Refused' } //$("#RESULT_COMPANY_ID" ).html("IT WORKED"); //$( "#dialog-result" ).html('SUCCESS'); $( "#dialog-result").dialog('option','title',dialogTitle); $( "#dialog-result" ).dialog('open'); }