1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /**
- * Created by Mai on 2017/3/10.
- */
- var PullData = function (url, data, successCallback, errorCallback) {
- $.ajax({
- type:"POST",
- url: url,
- data: {'data': JSON.stringify(data)},
- dataType: 'json',
- cache: false,
- timeout: 50000,
- success: function(result){
- if (result.error === 0) {
- successCallback(result.data);
- } else {
- alert('error: ' + result.message);
- errorCallback();
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- alert('error ' + textStatus + " " + errorThrown);
- errorCallback();
- }
- });
- };
- var GetProject = function (proj_id, callback) {
- $.ajax({
- type:"POST",
- url: '/pm/api/getProject',
- data: {'data': JSON.stringify({"user_id": userID, "proj_id": proj_id})},
- dataType: 'json',
- cache: false,
- timeout: 50000,
- success: function(result){
- if (result.error === 0) {
- callback(result.data);
- } else {
- alert('error: ' + result.message);
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- alert('error ' + textStatus + " " + errorThrown);
- }
- });
- };
- var GetBills = function (proj_id, callback) {
- $.ajax({
- type: "POST",
- url: '/getBills',
- data: {'data': JSON.stringify({"user_id": userID, "proj_id": proj_id})},
- dataType: 'json',
- cache: false,
- timeout: 50000,
- success: function (result) {
- if (result.error === 0) {
- callback(result.data);
- } else {
- alert('error: ' + result.message);
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- alert('error ' + textStatus + " " + errorThrown);
- }
- });
- };
- var GetRations = function (proj_id, callback) {
- $.ajax({
- type: "POST",
- url: '/getRations',
- data: {'data': JSON.stringify({"user_id": userID, "proj_id": proj_id})},
- dataType: 'json',
- cache: false,
- timeout: 50000,
- success: function (result) {
- if (result.error === 0) {
- callback(result.data);
- } else {
- alert('error: ' + result.message);
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- alert('error ' + textStatus + " " + errorThrown);
- }
- });
- };
|