function ajax_client_main(ajax_nm, frm_nm, p01, p02, p03, p04, p05) { var input_A = { ajax_nm: ajax_nm, p01: p01, p02: p02, p03: p03, p04: p04, p05: p05 }; // ============================== post ·Î Àü´ÞÇÒ parameter serialize var pre_result_A = ajax_pre_prcs(ajax_nm, frm_nm, input_A); if (pre_result_A.status == false) { if ($("#ajax-brd-loader").css("display") == 'block') If_Exists_Then_Visibilty('ajax-brd-loader', 'none'); return false; } var params = ""; if (frm_nm != '') params = $("#" + frm_nm).serialize(); if (params != '') params += "&"; //console.log(pre_result_A); if (pre_result_A == false) { } else if (typeof (pre_result_A.input_A.template_nm) !== 'undefined') input_A["template_nm"] = pre_result_A.input_A.template_nm; params += $.param(pre_result_A.input_A); //console.log(params); //console.log(input_A); // ============================== ajax call $.ajax({ type: 'POST', url: '/workdir/process/ajax_svr_main.php', data: params, error: function (xhr, status, error) { var error_txt = "code:" + xhr.status + "\n" + "message:" + ajax_error_code_2_txt(xhr, status) + "\n" + "error:" + error; var dt = new Date(); var dt_month = dt.getMonth() + 1; var dt_day = dt.getDate(); var dt_hour = dt.getHours(); var dt_min = dt.getMinutes(); var dt_key = dt.getFullYear() + '_' + (('' + dt_month).length < 2 ? '0' : '') + dt_month + '_' + (('' + dt_day).length < 2 ? '0' : '') + dt_day + '_' + (('' + dt_hour).length < 2 ? '0' : '') + dt_hour + '_' + (('' + dt_min).length < 2 ? '0' : '') + dt_min; Cjs_setCookie('ajx_err_' + dt_key, encodeURI(error_txt), 1); //console.log(error_txt); // --- if (ajax_nm == 'get_rlty_4_sns_post') setTimeout(function () { location.reload(); }, 30 * 1000); }, success: function (data) { // callback ÇÔ¼ö ajax_callback_func(ajax_nm, frm_nm, data, input_A); }, complete: function () { // return true; }, timeout: (120 * 1000) }); } // ======================================================================================== function If_Exists_Then_Visibilty(name_of_element, v_h_n) { var element = document.getElementById(name_of_element); if (typeof (element) != 'undefined' && element != null) { // exists. element.style.display = v_h_n; } } // ======================================================================================== function ajax_error_code_2_txt(xhr, status) { if (xhr.status === 0) return 'Not connect. Verify Network.'; else if (xhr.status == 400) return 'Server understood the request, but request content was invalid. [400]'; else if (xhr.status == 401) return 'Unauthorized access. [401]'; else if (xhr.status == 403) return 'Forbidden resource can not be accessed. [403]'; else if (xhr.status == 404) return 'Requested page not found. [404]'; else if (xhr.status == 500) return 'Internal server error. [500]'; else if (xhr.status == 503) return 'Service unavailable. [503]'; else if (status === 'parsererror') return 'Requested JSON parse failed. [Failed]'; else if (status === 'timeout') return 'Time out error. [Timeout]'; else if (status === 'abort') return 'Ajax request aborted. [Aborted]'; else return 'Uncaught Error : ' + xhr.responseText; }