main_ajax.js 651 B

123456789101112131415161718192021222324
  1. /**
  2. * Created by Mai on 2017/3/10.
  3. */
  4. var GetProject = function (proj_id, callback) {
  5. $.ajax({
  6. type:"POST",
  7. url: '/getProject',
  8. data: {'data': JSON.stringify({"user_id": userID, "proj_id": proj_id})},
  9. dataType: 'json',
  10. cache: false,
  11. timeout: 50000,
  12. success: function(result){
  13. if (result.error === 0) {
  14. callback(result.data);
  15. } else {
  16. alert('error: ' + result.message);
  17. }
  18. },
  19. error: function(jqXHR, textStatus, errorThrown){
  20. alert('error ' + textStatus + " " + errorThrown);
  21. }
  22. });
  23. }