| | |
| | | var httputil={ |
| | | post:function(url,params,success_callback,fail_callback){ |
| | | $.post(url,params,function(response){ |
| | | success_callback(response); |
| | | },'json').fail(function(jqXHR, textStatus, errorThrown){ |
| | | var http_util = { |
| | | post: function(url, params, success_callback, fail_callback) { |
| | | $.post(url, params, function(response) { |
| | | if (response.code == 1001) { |
| | | window.location.replace("login.html?redirect="+encodeURIComponent(window.location.href)); |
| | | } else { |
| | | success_callback(response); |
| | | } |
| | | }, 'json').fail(function(jqXHR, textStatus, errorThrown) { |
| | | fail_callback("网络请求失败"); |
| | | }); |
| | | }, |
| | | getQueryString:function(name) { |
| | | console.log(window.location.search) |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return unescape(decodeURI(r[2])); |
| | | return null; |
| | | } |
| | | }; |