Commit af8f94a6 authored by Sebastien Robin's avatar Sebastien Robin

define unique function to get url

parent 3e27d0b6
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
console.log("Error", error); console.log("Error", error);
}; };
priv.getUrl = function() {
return "http://localhost:5000/"
};
priv.initJsPlumb = function () { priv.initJsPlumb = function () {
jsPlumb.setRenderMode(jsPlumb.SVG); jsPlumb.setRenderMode(jsPlumb.SVG);
jsPlumb.importDefaults({ jsPlumb.importDefaults({
...@@ -189,7 +193,7 @@ ...@@ -189,7 +193,7 @@
priv.setSimulationParameters = function (simulation_parameters) { priv.setSimulationParameters = function (simulation_parameters) {
$.ajax({ $.ajax({
url: "http://localhost:5000/setSimulationParameters", url: priv.getUrl() + "setSimulationParameters",
type: 'POST', type: 'POST',
data: JSON.stringify(simulation_parameters), data: JSON.stringify(simulation_parameters),
contentType: "application/json", contentType: "application/json",
...@@ -225,7 +229,7 @@ ...@@ -225,7 +229,7 @@
priv.getModel = function (success) { priv.getModel = function (success) {
$.ajax({ $.ajax({
url: "http://localhost:5000/getModel", url: priv.getUrl() + "getModel",
type: 'GET', type: 'GET',
success: success, success: success,
error: function(xhr, textStatus, error) { error: function(xhr, textStatus, error) {
...@@ -237,7 +241,7 @@ ...@@ -237,7 +241,7 @@
priv.setModel = function () { priv.setModel = function () {
// Now communicate our model to the simulation server // Now communicate our model to the simulation server
$.ajax({ $.ajax({
url: "http://localhost:5000/setModel", url: priv.getUrl() + "setModel",
type: 'POST', type: 'POST',
data: JSON.stringify(model), data: JSON.stringify(model),
contentType: "application/json", contentType: "application/json",
...@@ -253,7 +257,7 @@ ...@@ -253,7 +257,7 @@
priv.updateModel = function () { priv.updateModel = function () {
// Now communicate our model to the simulation server // Now communicate our model to the simulation server
$.ajax({ $.ajax({
url: "http://localhost:5000/updateModel", url: priv.getUrl() + "updateModel",
type: 'POST', type: 'POST',
data: JSON.stringify(model), data: JSON.stringify(model),
contentType: "application/json", contentType: "application/json",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment