mirror of
https://github.com/dzeiocom/FormManager.git
synced 2025-06-07 16:49:56 +00:00
Added a possible Callback to filFromURI
This commit is contained in:
parent
36c41446ea
commit
5f3ba54ccf
@ -310,13 +310,14 @@ export default class FormManager {
|
|||||||
* @param {string} uri the URI
|
* @param {string} uri the URI
|
||||||
* @memberof FormManager
|
* @memberof FormManager
|
||||||
*/
|
*/
|
||||||
public fillFromURI(uri: string) {
|
public fillFromURI(uri: string, callback?: () => void) {
|
||||||
let ajax = new XMLHttpRequest
|
let ajax = new XMLHttpRequest
|
||||||
ajax.open("GET", uri, true)
|
ajax.open("GET", uri, true)
|
||||||
ajax.addEventListener("loadend", (e) => {
|
ajax.addEventListener("loadend", (e) => {
|
||||||
if (ajax.readyState === 4 && ajax.status === 200) {
|
if (ajax.readyState === 4 && ajax.status === 200) {
|
||||||
let json = JSON.parse(ajax.responseText)
|
let json = JSON.parse(ajax.responseText)
|
||||||
this.fillFromJSON(json)
|
this.fillFromJSON(json)
|
||||||
|
if (callback != undefined) callback()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ajax.send()
|
ajax.send()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user