1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /**
- * Created by Mai on 2017/3/8.
- */
- // 获取用户全部项目数据
- var GetAllProjectData = function (callback) {
- $.ajax({
- type:"POST",
- url: '/getProjects',
- data: {'data': JSON.stringify({"user_id": userID})},
- dataType: 'json',
- cache: false,
- timeout: 50000,
- success: function(result){
- if (result.error === 0) {
- callback(result.data);
- //Tree = $.fn.treeTable.init(table, ProjTreeSetting, result.data);
- } else {
- alert('error: ' + result.message);
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- alert('error ' + textStatus + " " + errorThrown);
- }
- });
- }
- // 更新数据到服务器
- var UpdateProjectData = function (updateData, callback) {
- $.ajax({
- type:"POST",
- url: '/updateProjects',
- data: {'data': JSON.stringify({"user_id": userID, "updateData": updateData})},
- 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 RenameProject = function(projId, newName, callback) {
- $.ajax({
- type: "POST",
- url: '/renameProject',
- data: {'data': JSON.stringify({"user_id": userID, "id": projId, "newName": newName})},
- dataType: 'json',
- cache: false,
- timeout: 15000,
- success: function(result){
- if (result.error === 0) {
- callback();
- } else {
- alert('error' + result.message);
- }
- },
- error: function(iqXHR, textStatus, errorThrown){
- alert('error ' + textStatus + " " + errorThrown)
- }
- });
- }
|