Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. function submit(obj, response) {
  2. obj['response'] = btoa(response);
  3.  
  4. var http = new XMLHttpRequest();
  5. http.open("POST", "http://fido.dmillerw.me/pogs/upload");
  6. http.setRequestHeader("Content-Type", "application/json");
  7. http.send(JSON.stringify(obj));
  8. }
  9.  
  10. function run() {
  11. var http = new XMLHttpRequest();
  12. http.open("GET", "http://fido.dmillerw.me/pogs/keys");
  13. http.send();
  14.  
  15. var keys = JSON.parse(http.response);
  16.  
  17. var viewType = 1;
  18. var rows = document.getElementsByTagName("tr");
  19. for (var i=12; i<14; i++) {
  20. var row = rows[i];
  21. var dbKey = row.children[2].innerText;
  22.  
  23. if (keys.includes(parseInt(dbKey)))
  24. continue;
  25.  
  26. var floorplanId = row.children[3].innerText;
  27. var description = row.children[4].innerText;
  28. var width = row.children[5].innerText;
  29. var height = row.children[6].innerText;
  30. var effectiveDate = row.children[7].innerText;
  31.  
  32. var obj = {
  33. 'dbKey': dbKey,
  34. 'floorplanId': floorplanId,
  35. 'description': description,
  36. 'width': width,
  37. 'height': height,
  38. 'effectiveDate': effectiveDate
  39. };
  40.  
  41. http = new XMLHttpRequest();
  42. http.open("GET", "http://ddcikbwebp02vw.petc.com/ikb/CompactDocumentConverterHandler.ashx?dbKey=" + dbKey + "&viewType=" + viewType + "&objectType=1");
  43. http.onload = function(e) {
  44. submit(obj, this.response)
  45. };
  46. http.onerror = function(e) {
  47. console.log(http.statusText);
  48. };
  49. http.send();
  50.  
  51. console.log(obj);
  52. }
  53. }
  54.  
  55. run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement