Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.35 KB | None | 0 0
  1. <textarea id="data" rows="15" cols="80">
  2.     {  
  3.       "completedProtocol": "Extract",
  4.       "map": [
  5.         {
  6.           "sampleIDsIn": [{ "clarityId": "claritySample1", "espId": "ESP024254" }, { "clarityId": "claritySample1", "espId": "ESP024255" }, { "clarityId": "claritySample1", "espId": "ESP024256" }],
  7.           "sampleIDsOut": ["claritySample3"],
  8.           "files":["http://fileserver.net/path/to/datafile3"]
  9.         },
  10.         {
  11.           "sampleIDsIn": [{ "clarityId": "claritySample1", "espId": "ESP024458" }, { "clarityId": "claritySample1", "espId": "ESP024459" }, { "clarityId": "claritySample1", "espId": "ESP024460" }],
  12.           "sampleIDsOut": ["claritySample3"],
  13.           "files":["http://fileserver.net/path/to/datafile3"]
  14.         }
  15.       ]
  16.     }
  17. </textarea>
  18. <input type=button onclick="test()" value="Test"/>
  19.  
  20. <pre id="output"></pre>
  21.  
  22.  
  23. <script>
  24.  
  25. function test() {
  26. try {
  27.   var raw = $("#data").val();
  28.  
  29.   $.ajax({
  30.     method: "POST",
  31.     contentType: "application/json",
  32.     processData: false,
  33.     url: "/api/apps/clarity/advance",
  34.     data: raw,
  35.     success: function(data,status, xhr) {
  36.       debugger;
  37.       $("#output").html(JSON.stringify(data,null,2));
  38.     },
  39.     error: function(xhr, options, error) {
  40.       debugger;
  41.       alert(error);
  42.     }
  43.   });
  44.  
  45. } catch(e) {
  46.   alert("error: " + e);
  47. }
  48. }
  49. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement