/******************************************************************************* * Copyright (c) 2012-2013 University of Stuttgart. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and the Apache License 2.0 which both accompany this distribution, * and are available at http://www.eclipse.org/legal/epl-v10.html * and http://www.apache.org/licenses/LICENSE-2.0 * * Contributors: * Oliver Kopp - initial API and implementation and/or initial documentation *******************************************************************************/ function addResourceInstance() { if (highlightRequiredFields()) { vShowError("Please fill in all required fields"); return; } var dataToSend = $('#createResourceForm').serialize(); var cr = $('#createResource'); $.ajax({ type: "POST", async: false, "data": dataToSend, "url": cr.data("url"), dataType: "text", error: function(jqXHR, textStatus, errorThrown) { vShowAJAXError("Could not create resource", jqXHR, errorThrown); cr.modal("hide"); }, success: function(resData, textStatus, jqXHR) { cr.data("onSuccess")($('#createResourceForm').serializeArray(), resData, textStatus, jqXHR); cr.modal('hide'); } }); } /** * This function creates a dialog, where the user can add key/value pairs. * These pairs are then sent to the given URL via POST. * * REQUIRES