function updateInfo(us_id){ $("#updating").css("display", "block"); $.ajax({ url: 'update_user/' + us_id, type: 'POST', data: $("#frm1").serialize(), success: function (data, textStatus, jqXHR) { $("#updating").css("display", "none"); result = jQuery.parseJSON(data); if (result.success == "1") { $("#updateInfoSuccess").modal('show'); //$("#close").click(function(){window.location.reload(true)}); $('#updateInfoSuccess').on('hidden.bs.modal', function () { window.location.reload(true); }); } else { for (var key in result.errors) { $('#'+key).html(result.errors[key]); } } } }); } $( "#package_register" ).submit(function( event ) { $.ajax({ url: $(this).attr("action"), type: "POST", data: $("#package_register").serialize(), success: function (data, textStatus, jqXHR) { var results= jQuery.parseJSON(data); $('#package_register_modal').replaceWith(results.modal); $('#package_register_modal').modal('show'); }, error: function (jqXHR, textStatus, errorThrown) { $(".ajaxloading").hide(); } }); event.preventDefault(); }); function changePassword(us_id) { $('#passwd_old_err').html(""); $('#passwd_new_err').html(""); $('#confirm_passwd_new_err').html(""); $.ajax({ url: 'change_password/' + us_id, type: 'POST', data: $("#frm2").serialize(), success: function (data, textStatus, jqXHR) { result = jQuery.parseJSON(data); if (result.success == "1") { $("#changePassSuccess").modal('show'); } else { for (var key in result.errors) { $('#'+key).html(result.errors[key]); } } } }); } function clearFormFields(id){ $(id).find('input:text, input:hidden, input:password, input:file, select, textarea').val(''); $(id).find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected'); $(id).find('.help-block').html(""); } $('body').on('hidden.bs.modal', '.modal', function () { clearFormFields('#frm2'); });