From ff91d5fd0ad4ba061f2863c2cc64c69d1c344716 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Wed, 27 Feb 2013 00:56:39 +0100 Subject: [PATCH] bypass the same origin policy * we get our data now from a python script on same server as the webpage * url was changed to our own server * we must delete one char more at begin and end of the response string --- scripts/haltestellen.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/haltestellen.js b/scripts/haltestellen.js index 015a4bb..fed5f5d 100644 --- a/scripts/haltestellen.js +++ b/scripts/haltestellen.js @@ -3,7 +3,8 @@ var DEBUG; // server url -var serverUrl = "http://widgets.vvo-online.de/abfahrtsmonitor/"; +//var serverUrl = "http://widgets.vvo-online.de/abfahrtsmonitor/"; +var serverUrl = "http://goodcleanfun.de/cgi-bin/"; // xmlhttp object function @@ -87,7 +88,8 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) { // get output area var target = document.getElementById("output"); var hstName = document.getElementById("q").value; - var hstUrl = serverUrl + "Abfahrten.do?ort=dresden&hst=" + hstName; + //var hstUrl = serverUrl + "Abfahrten.do?ort=dresden&hst=" + hstName; + var hstUrl = serverUrl + "abfahrtsmonitor.py?ort=dresden&hst=" + hstName; ajaxCall(hstUrl, target, function(data) { @@ -97,7 +99,7 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) { data = data.replace(/\],\[/gi, '#'); data = data.replace(/\(.+?\)/gi, ''); data = data.replace('ß', 'ss'); - data = data.slice(2,-2).split("#"); + data = data.slice(3,-3).split("#"); // debug log if (DEBUG === 1) {console.log("parsed data: " + data);}