common.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <<<<<<< HEAD
  2. var baseUrl = 'http://pay-test.278740.cn'
  3. /**
  4. * 获取请求ajax数据
  5. * @param url 请求地址
  6. * @param type 请求类型
  7. * @param data 需要发送的数据
  8. * @param callback 成功回调方法
  9. * @param alert 成功后是否提示成功信息
  10. */
  11. var getAjax = function (url, type, data, callback, alert, noneShow,errorF) {
  12. // !noneShow ? showLoading() : null;
  13. $.ajax({
  14. url: url,
  15. type: type,
  16. dataType: 'JSON',
  17. data: data,
  18. success: function (result) {
  19. if (result.state == 0) {
  20. typeof callback == 'function' ? callback(result) : null;
  21. if (alert) Popup.toast(result.msg || " ");
  22. // !noneShow ? hideLoading() : null;
  23. } else {
  24. Popup.toast(result.msg || " ");
  25. // !noneShow ? hideLoading() : null;
  26. typeof errorF == 'function'?errorF():null;
  27. }
  28. },
  29. error: function (err) {
  30. Popup.toast(err || " ");
  31. // !noneShow ? hideLoading() : null;
  32. typeof errorF == 'function'?errorF():null;
  33. }
  34. })
  35. =======
  36. var baseUrl = 'http://pay-test.278740.cn'
  37. /**
  38. * 获取请求ajax数据
  39. * @param url 请求地址
  40. * @param type 请求类型
  41. * @param data 需要发送的数据
  42. * @param callback 成功回调方法
  43. * @param alert 成功后是否提示成功信息
  44. */
  45. var getAjax = function (url, type, data, callback, alert, noneShow,errorF) {
  46. // !noneShow ? showLoading() : null;
  47. $.ajax({
  48. url: url,
  49. type: type,
  50. dataType: 'JSON',
  51. data: data,
  52. success: function (result) {
  53. if (result.state == 0) {
  54. typeof callback == 'function' ? callback(result) : null;
  55. if (alert) Popup.toast(result.msg || " ");
  56. // !noneShow ? hideLoading() : null;
  57. } else {
  58. Popup.toast(result.msg || " ");
  59. // !noneShow ? hideLoading() : null;
  60. typeof errorF == 'function'?errorF():null;
  61. }
  62. },
  63. error: function (err) {
  64. Popup.toast(err || " ");
  65. // !noneShow ? hideLoading() : null;
  66. typeof errorF == 'function'?errorF():null;
  67. }
  68. })
  69. >>>>>>> cb3d90368273b7ba0ce18e05382d00be6933949f
  70. };