Advertisement
vikikurnia87

Untitled

Dec 10th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <div class="modal fade" id="errorAlert" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  2. <div class="modal-dialog" role="document">
  3. <div class="modal-content">
  4. <div class="modal-body">
  5. <center><?php //echo $this->session->flashdata('hasil'); ?></center>
  6. </div>
  7. <div class="modal-footer">
  8. <a href="" style="cursor: pointer;">
  9. <button class="btn btn-primary-learn" data-dismiss="modal" style=";text-transform: capitalize;color: #fff;cursor: pointer;">Tutup</button>
  10. </a>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15.  
  16. <script>
  17. $(function () {
  18. $('form').on('submit', function (e) {
  19. e.preventDefault();
  20. $.ajax({
  21. type: 'POST',
  22. url: '<?php echo base_url() ?>Profil/perusahaan_added',
  23. data: $('form').serialize(),
  24. success: function (data) {
  25. //alert('form was submitted');
  26. data = $.parseJSON(data); // parse text to json object
  27. console.log(data);
  28. if (data.loginStatus) { // check if loginStatus is true
  29. window.location.href = data.redirectUrl
  30. } else { // else show the error message
  31. // $('#errorAlert').modal('show');
  32. // setTimeout(function () {
  33. // $('#errorAlert').fadeOut("slow");
  34. // }, 2000);
  35. //alert('gagal');
  36. $('#errorAlert').modal('show');
  37. }
  38. },
  39. error : function(xhr) {
  40. // if(xhr.status==404){
  41. // alert("404");
  42. // }else if(xhr.status==400){
  43. // alert("400");
  44. // }else{
  45. // alert("error lain");
  46. // }
  47. alert('gagal2');
  48. }
  49. });
  50. });
  51. });
  52. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement