Function get

Loads the specified URL asynchronously and invokes the given functions depending on the request status. Returns the in use. Both functions take the as the only parameter. See Utils#load for a synchronous implementation.

Example:

mxUtils.get(url, (req)=>
{
let node = req.getDocumentElement();
// Process XML DOM...
});

So for example, to load a diagram into an existing graph model, the following code is used.

mxUtils.get(url, (req)=>
{
let node = req.getDocumentElement();
let dec = new Codec(node.ownerDocument);
dec.decode(node, graph.getDataModel());
});
  • Parameters

    • url: string

      URL to get the data from.

    • onload: null | Function = null

      Optional function to execute for a successful response.

    • onerror: null | Function = null

      Optional function to execute on error.

    • binary: boolean = false

      Optional boolean parameter that specifies if the request is binary.

    • timeout: null | number = null

      Optional timeout in ms before calling ontimeout.

    • ontimeout: null | Function = null

      Optional function to execute on timeout.

    • headers: null | {
          [key: string]: string;
      } = null

      Optional with headers, eg. {'Authorization': 'token xyz'}

    Returns MaxXmlRequest