input.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. function input_person_init() {
  2. $('#content').html('');
  3. $('#result').html('');
  4. var str = '<form enctype="multipart/form-data" action="../servlet/input/person" method="post" target="_blank" id="form"><table border="1" width="100%">';
  5. str += '<tr><td colspan="2"><a href="#" id="post">post</a></td></tr>';
  6. str += '<tr><td>file:</td><td><input type="file" name="file" style="width:95%" id= "file"/></td></tr>';
  7. str += '</table></form>';
  8. $('#content').html(str);
  9. $('#post').click(function() {
  10. $('#form').submit();
  11. });
  12. }
  13. // function input_post() {
  14. // var formData = new FormData($('form')[0]);
  15. // $.ajax({
  16. // type : 'post',
  17. // //dataType : 'json',
  18. // url : '../servlet/input/person',
  19. // data : formData,
  20. // contentType : false,
  21. // cache : false,
  22. // processData : false,
  23. // xhrFields : {
  24. // 'withCredentials' : true
  25. // },
  26. // crossDomain : true
  27. // });
  28. // }
  29. // function input_person_init() {
  30. // $('#result').html('');
  31. // str = '<table border="1" width="100%">';
  32. // str += '<tr><td colspan="2"><a href="#" id="post">post</a></td></tr>';
  33. // str += '<tr><td>file:</td><td><input type="file" id="file"
  34. // style="width:95%"/></td></tr>';
  35. // str += '</table>';
  36. // $('#content').html(str);
  37. // $('#post').click(function() {
  38. // input_person_post();
  39. // });
  40. // }
  41. //
  42. // function input_person_post() {
  43. // var formData = new FormData();
  44. // formData.append('file', $('#file')[0].files[0]);
  45. // $.ajax({
  46. // type : 'post',
  47. // dataType : 'json',
  48. // url : '../servlet/input/person',
  49. // xhrFields : {
  50. // 'withCredentials' : true
  51. // },
  52. // cache : false,
  53. // processData : false,
  54. // contentType : false,
  55. // data : formData
  56. // }).always(function(json) {
  57. // $('#result').html(JSON.stringify(json, null, 4));
  58. // });
  59. // }