GoalModelEditor/FrontEnd/public/js/dashboard.js
/**
 * Ajax function for creating a goal model
 *
 * @param {url} url - to specify the user & project
 * @param {String} pid - projectID - to help find HTMLElement to append to
 * @param {formData} model - formData with encapsulated modelName
 */
Ajax function for creating a goal model
@param {url} url - to specify the user & project
@param {String} pid - projectID - to help find HTMLElement to append to
@param {formData} model - formData with encapsulated modelName
Ajax function for creating a goal model @param { url } url - to specify the user & project @param { String } pid - projectID - to help find HTMLElement to append to @param { formData } model - formData with encapsulated modelName
function createGoalModel(url, pid, model) {
    $.ajax(url, {
        data: model,
        type: "POST",
        headers: { Authorization: "Bearer " + TOKEN },
        success: function(model) {
            setMID(model.model_id);
            let modelHTML = parseGoalModel(model);
            appendToProject(modelHTML, pid);
            successMessageSlide("Model: " + model.model_name + " successfully created.");
            removeCustomizedEventListeners();
            addListenersToNewItem();
            $("#add-model .modal-body input").val("");
            window.location.href = "/goal_model/edit?MID=" + getMID();
        }
    }).fail(function(jqXHR) {
        warningMessageSlide(jqXHR.responseJSON.message + "<br>Please try again.");
    }); 
}
function createGoalModel ( url , pid , model ) { $ . ajax ( url , { data : model , type : "POST" , headers : { Authorization : "Bearer " + TOKEN } , success : function ( model ) { setMID ( model . model_id ) ; let modelHTML = parseGoalModel ( model ) ; appendToProject ( modelHTML , pid ) ; successMessageSlide ( "Model: " + model . model_name + " successfully created." ) ; removeCustomizedEventListeners ( ) ; addListenersToNewItem ( ) ; $ ( "#add-model .modal-body input" ) . val ( "" ) ; window . location . href = "/goal_model/edit?MID=" + getMID ( ) ; } } ) . fail ( function ( jqXHR ) { warningMessageSlide ( jqXHR . responseJSON . message + "<br>Please try again." ) ; } ) ; }
Ajax function for creating a goal model
 @param {url} url - to specify the user & project
 @param {String} pid - projectID - to help find HTMLElement to append to
 @param {formData} model - formData with encapsulated modelName
Ajax function for creating a goal model @param { url } url - to specify the user & project @param { String } pid - projectID - to help find HTMLElement to append to @param { formData } model - formData with encapsulated modelName
// Append the new model to the UI // Add listeners // Re-initialize the input for the modal // Re-direct the user to the new model // end ajax