Back

postMyForm

Copy Below Code View As A Text File Show Text Only Show API Edit Code
                            

function postMyForm(postURL,dataObj,cbfunc){ var pageName =postURL; $.ajax({ type: "POST", timeout: 200000, url: pageName, //data: parameters, data: dataObj, beforeSend: function(){}, success: function(msg){ if($(".subm").length>0) { if(typeof(btnText)!=='undefined') { $(".subm").html(btnText); }else { $(".subm").html('Submit'); } $("#loader_div").hide(); $(".subm").attr('disabled',false); } if(isJson(msg)==false){alert('ERROR::'+msg);$("#loader_div").hide();return false;} obj = JSON.parse(msg); if(obj.success=='done'){ cbfunc(); } else{ Swal.fire({ icon: 'error', title: 'Error!', timer:2000, text:obj.errormsg, footer: '' }); //RR location.reload(); } }, error: function(jqXHR, textStatus, errorThrown) { if($(".subm").length>0) { if(typeof(btnText)!=='undefined') { $(".subm").html(btnText); }else { $(".subm").html('Submit'); } $("#loader_div").hide(); $(".subm").attr('disabled',false); } if(errorThrown=='Unauthorized') { Swal.fire({ icon: 'error', title: 'ERROR!', text: 'You are not logged in!', footer: '<a href="'+baseURL+'login">Click here</a> to login' }); return false; } if(textStatus==="timeout") { alert("ERROR: Connection problem"); //Handle the timeout } else { alert("ERROR: There is something wrong."); } //RR location.reload(); } }); }