oberfritze
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
23 deletions
-
src/web/html/api.js
|
|
@ -140,21 +140,13 @@ function getCSV(url, ptr) { |
|
|
|
if(xhr != null) { |
|
|
|
xhr.open("GET", url, true); |
|
|
|
xhr.onreadystatechange = q; |
|
|
|
try { |
|
|
|
xhr.send(); |
|
|
|
} catch (error) { |
|
|
|
console.log(error.message); |
|
|
|
} |
|
|
|
} |
|
|
|
function q() { |
|
|
|
if(xhr.readyState == 4) { |
|
|
|
if(null != xhr.responseText) { |
|
|
|
if(null != ptr) { |
|
|
|
try { |
|
|
|
ptr(xhr.responseText); |
|
|
|
} catch (error) { |
|
|
|
console.log(error.message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -168,22 +160,13 @@ function getAjax(url, ptr, method="GET", json=null) { |
|
|
|
xhr.onreadystatechange = p; |
|
|
|
if("POST" == method) |
|
|
|
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); |
|
|
|
try { |
|
|
|
xhr.send(json); |
|
|
|
} catch (error) { |
|
|
|
console.log(error.message); |
|
|
|
} |
|
|
|
} |
|
|
|
function p() { |
|
|
|
if(xhr.readyState == 4) { |
|
|
|
if(null != xhr.responseText) { |
|
|
|
if(null != ptr) { |
|
|
|
try { |
|
|
|
if(null != ptr) |
|
|
|
ptr(JSON.parse(xhr.responseText)); |
|
|
|
} catch (error) { |
|
|
|
console.log(error.message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|