Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#f1").on("submit", function (event) {
- event.preventDefault();
- do_proses('f1','index/login','home');
- });
- function do_proses(form_id,act_controller,after_controller){
- $.ajax({
- url: act_controller,
- type: 'POST',
- data: new FormData($('#'+form_id)[0]), // Form ID
- processData: false,
- contentType: false,
- success: function(data) {
- var data_trim = $.trim(data);
- if(data_trim=="OK"){
- swal({
- title: 'Success',
- type: 'success',
- showCancelButton: false,
- showLoaderOnConfirm: false,
- }).then(function() {
- if(after_controller!=''){
- window.location = after_controller;
- }
- else {
- location.reload();
- }
- });
- }
- else if(data_trim=="NOK"){
- swal({
- title: 'Error',
- text: "Username / Password Salah",
- type: 'error',
- showCancelButton: false,
- showLoaderOnConfirm: false,
- });
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement