11let baseUrl = "http://localhost:8080/"
22let classificationDropDown ;
33let importedShapes ;
4+ let tableKey ;
45
56$ ( document ) . ready ( function ( ) {
67 getOHDMInformation ( ) ;
@@ -12,6 +13,12 @@ function getOHDMInformation()
1213 let xhr = new XMLHttpRequest ( ) ;
1314 let url = baseUrl + "OHDMInformation" ;
1415 xhr . open ( "GET" , url , true ) ;
16+ tableKey = getUrlVars ( ) [ "tableKey" ] ;
17+
18+ if ( tableKey )
19+ {
20+ sendDataWithKey ( tableKey ) ;
21+ }
1522
1623 xhr . onload = function ( e )
1724 {
@@ -64,6 +71,31 @@ function sendData()
6471 xhr . send ( ) ;
6572}
6673
74+ function sendDataWithKey ( tableKey )
75+ {
76+
77+ let xhr = new XMLHttpRequest ( ) ;
78+ let url = baseUrl + "ShapeUpdate?tableKey=" + tableKey ;
79+ tableKey = "" ;
80+
81+ xhr . open ( "GET" , url , true ) ;
82+
83+ xhr . onload = function ( e )
84+ {
85+ if ( this . status === 200 )
86+ {
87+ let data = this . response ;
88+ let dataObj = JSON . parse ( data ) ;
89+
90+ console . log ( dataObj ) ;
91+ $ ( "#importedShapes" ) . empty ( ) ;
92+ displayImportedShapes ( dataObj . importedShapes ) ;
93+ importedShapes = dataObj . importedShapes ;
94+ }
95+ } ;
96+ xhr . send ( ) ;
97+ }
98+
6799function displayImportedShapes ( importedShapes )
68100{
69101 for ( let i = 0 ; i < importedShapes . length ; i ++ )
@@ -211,4 +243,12 @@ function sendUpdateObj(obj)
211243 }
212244 } ;
213245 xhr . send ( formData ) ;
246+ }
247+
248+ function getUrlVars ( ) {
249+ var vars = { } ;
250+ var parts = window . location . href . replace ( / [ ? & ] + ( [ ^ = & ] + ) = ( [ ^ & ] * ) / gi, function ( m , key , value ) {
251+ vars [ key ] = value ;
252+ } ) ;
253+ return vars ;
214254}
0 commit comments