GoalModelEditor/FrontEnd/public/js/projectEdit/graphXML.js
/**
 * send XML to backend
 * @param isTemplate
 */
send XML to backend
@param isTemplate
send XML to backend @param isTemplate
function sendXML(isTemplate) {
    let secret = JSON.parse(Cookies.get("LOKIDIED"));
    let token = secret.token;
    let userId = secret.uid;
    let modelId = Cookies.get("MID");
    let url = "/goal_model/xml/" + userId + "/" + modelId;
    if (isTemplate) {
        let templateId = Cookies.get("TID");
        url = "/template/" + userId + "/" + templateId;
    }
    let xml = parseToXML(graph);
    $.ajax(url, {
        type: "PUT",
        contentType: "application/json",
        data: JSON.stringify({xml: xml}),
        async: true,
        headers: {Authorization: "Bearer " + token},
        success: function () {
            $("#success-alert").html("Graph successfully Saved.");
            $("#success-alert")
                .slideDown()
                .delay(3000)
                .slideUp();
        }
    }).fail(function (jqXHR) {
        $("#warning-alert").html(
            jqXHR.responseJSON.message + " <br>Please try again."
        );
        $("#warning-alert")
            .slideDown()
            .delay(3000)
            .slideUp();
    }); 
}
function sendXML ( isTemplate ) { let secret = JSON . parse ( Cookies . get ( "LOKIDIED" ) ) ; let token = secret . token ; let userId = secret . uid ; let modelId = Cookies . get ( "MID" ) ; let url = "/goal_model/xml/" + userId + "/" + modelId ; if ( isTemplate ) { let templateId = Cookies . get ( "TID" ) ; url = "/template/" + userId + "/" + templateId ; } let xml = parseToXML ( graph ) ; $ . ajax ( url , { type : "PUT" , contentType : "application/json" , data : JSON . stringify ( { xml : xml } ) , async : true , headers : { Authorization : "Bearer " + token } , success : function ( ) { $ ( "#success-alert" ) . html ( "Graph successfully Saved." ) ; $ ( "#success-alert" ) . slideDown ( ) . delay ( 3000 ) . slideUp ( ) ; } } ) . fail ( function ( jqXHR ) { $ ( "#warning-alert" ) . html ( jqXHR . responseJSON . message + " <br>Please try again." ) ; $ ( "#warning-alert" ) . slideDown ( ) . delay ( 3000 ) . slideUp ( ) ; } ) ; }
send XML to backend
 @param isTemplate
send XML to backend @param isTemplate
// the API of upload pictures // end ajax