moell.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. var Moell = window.Moell || {};
  2. var _token = $("meta[name='_token']").attr('content');
  3. (function(Moell) {
  4. Moell.ajax = {
  5. delete: function (url) {
  6. layer.confirm('你确认删除吗?', {
  7. btn: ['删除', '取消']
  8. }, function () {
  9. $.post(url, {'_method': "DELETE", '_token': _token}, function (data) {
  10. var msg;
  11. var icon;
  12. if (data.status == 0) {
  13. layer.msg('删除成功', {time: 5000, icon: 6});
  14. window.location.href = window.location.href;
  15. } else {
  16. layer.msg('删除失败', {time: 5000, icon: 5});
  17. }
  18. });
  19. }, function () {
  20. layer.close();
  21. })
  22. }
  23. },
  24. Moell.form = {
  25. reset: function (form, resetBtn) {
  26. $(resetBtn).click(function () {
  27. $(form).data('bootstrapValidator').resetForm(true);
  28. $(form)[0].reset();
  29. });
  30. }
  31. }
  32. })(Moell);