WXMobileAdmin.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //private
  2. function refreshUrl(result) {
  3. if(result.url === undefined||result.url===''){
  4. parent.location.reload();
  5. }else{
  6. window.location.href=result.url;
  7. }
  8. }
  9. //private
  10. function showResultInfo(result) {
  11. if(result.status == 1) {
  12. if (result.info != undefined && result.info != '') {
  13. $.alert(result.info, "提示", function () {
  14. refreshUrl(result);
  15. });
  16. }else{
  17. refreshUrl(result);
  18. }
  19. }else{
  20. if(result.info!=undefined&&result.info!=''){
  21. $.alert(result.info, "提示", function () {
  22. if(result.url === undefined||result.url===''){
  23. // parent.location.reload();
  24. }else{
  25. window.location.href=result.url;
  26. }
  27. // refreshUrl(result);
  28.  });
  29. }else{
  30. if(result.url === undefined||result.url===''){
  31. // parent.location.reload();
  32. }else{
  33. window.location.href=result.url;
  34. }
  35. // refreshUrl(result);
  36. }
  37. }
  38. }
  39. // $(document).ready(function () {
  40. // //表单静态提交,并且刷新本页
  41. // $('.ajax-form').ajaxSubmit(function(result){
  42. // showResultInfo(result);
  43. // });
  44. // });
  45. function isFunction(fn) {
  46. return Object.prototype.toString.call(fn) === '[object Function]';
  47. }
  48. function get_data(url, callback) {
  49. $.showLoading();
  50. $.get(url, function (result) {
  51. $.hideLoading();
  52. if (callback != undefined && isFunction(callback)) {
  53. callback(result);
  54. }
  55. });
  56. }
  57. function post_data(url, data, callback) {
  58. $.showLoading();
  59. $.post(url, data, function (result) {
  60. $.hideLoading();
  61. if (callback != undefined && isFunction(callback)) {
  62. callback(result);
  63. }
  64. });
  65. }