entity_fileinfo.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. var service_base_path = '../jaxrs/fileinfo';
  2. function data_get_document( ) {
  3. var service_url = $("#get_service_url").val();
  4. var query_url = service_base_path + "/" + service_url;
  5. //获取用户所填写的参数
  6. var id = $("#id").val();
  7. var documentId = $("#documentId").val();
  8. //根据参数组织URL
  9. if( "{id}" == service_url ){
  10. query_url = query_url.replace( "{id}",id );
  11. if( id == null || id == "" || id == undefined){
  12. alert("请填写ID");return false;
  13. }
  14. }else if( "list/document/{documentId}" == service_url ){
  15. query_url = query_url.replace( "{documentId}",documentId );
  16. if( documentId == null || documentId == "" || documentId == undefined){
  17. alert("请填写documentId");return false;
  18. }
  19. }
  20. alert(query_url);
  21. $.ajax({
  22. type : 'get',
  23. dataType : 'json',
  24. contentType : 'application/json; charset=utf-8',
  25. url : query_url,
  26. xhrFields : {
  27. 'withCredentials' : true
  28. },
  29. crossDomain : true
  30. }).done(function(json) {
  31. $('#result').html( JSON.stringify( json, null, 4) );
  32. }).fail(function(json) {
  33. failure(json);
  34. });
  35. }
  36. function data_delete_document( id ) {
  37. if( id == null || id == undefined || id == "" ){
  38. alert("请输入ID");
  39. return false;
  40. }
  41. $.ajax({
  42. type : 'delete',
  43. dataType : 'json',
  44. contentType : 'application/json; charset=utf-8',
  45. url : service_base_path + "/" + id ,
  46. xhrFields : {
  47. 'withCredentials' : true
  48. },
  49. crossDomain : true
  50. }).done(function(json) {
  51. $('#result').html(JSON.stringify(json.data, null, 4));
  52. });
  53. }