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
|
||||
* @memberof FormManager
|
||||
*/
|
||||
public fillFromURI(uri: string) {
|
||||
let ajax = new XMLHttpRequest
|
||||
public fillFromURI(uri: string, callback?: () => void) {
|
||||
let ajax = new XMLHttpRequest
|
||||
ajax.open("GET", uri, true)
|
||||
ajax.addEventListener("loadend", (e) => {
|
||||
if (ajax.readyState === 4 && ajax.status === 200) {
|
||||
let json = JSON.parse(ajax.responseText)
|
||||
this.fillFromJSON(json)
|
||||
if (callback != undefined) callback()
|
||||
}
|
||||
})
|
||||
ajax.send()
|
||||
|
Loading…
x
Reference in New Issue
Block a user