1234567891011121314151617181920212223242526272829303132333435 |
- var util = {
- g_url:"http://127.0.0.1:8081/",
- ajax_arr: function(url, data, method, success_fn, error_fn) {
-
- $.ajax({
- url: url,
- data: JSON.stringify(data),
- type: method,
- headers: {'Content-Type': 'application/json;charset=utf-8'},
- dataType: 'json',
- success: function(res){
- //res = JSON.parse(res)
- console.log(res)
- if (res.code == 1 || res.code == 200) {
- success_fn(res)
- } else {
- if (error_fn) {
- error_fn(res)
- }
- }
- },
- error: function (error) {
- console.log("请求出错原因:",error);
- }
- });
- },
- }
-
|