RT# 81730 - added code to fix possible cross origin request error
authorChristopher Burger <burgerc@freeside.biz>
Fri, 16 Nov 2018 16:14:32 +0000 (11:14 -0500)
committerChristopher Burger <burgerc@freeside.biz>
Fri, 16 Nov 2018 16:14:32 +0000 (11:14 -0500)
httemplate/misc/openmap.html
httemplate/misc/xmlhttp-openstreetmap.html [new file with mode: 0644]

index 7cbe3db..88f64c1 100644 (file)
@@ -18,7 +18,7 @@
 
   <script>
 
-    var url = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q=<%$loc%>';
+    var url = 'xmlhttp-openstreetmap.html?loc=<%$loc%>';
     $.getJSON(url,function(data){
       var latlong = [data[0].lat, data[0].lon];
       var mymap = L.map('mapid').setView(latlong, 15);
diff --git a/httemplate/misc/xmlhttp-openstreetmap.html b/httemplate/misc/xmlhttp-openstreetmap.html
new file mode 100644 (file)
index 0000000..bf6625c
--- /dev/null
@@ -0,0 +1,15 @@
+<% $return %>\
+<%init>
+
+my $DEBUG = 0;
+
+my $conf = new FS::Conf;
+
+my $return = {};
+
+my $url = "http://nominatim.openstreetmap.org/search?format=json&limit=1&q=" . $cgi->param('loc');
+
+use LWP::Simple;
+my $return = get $url;
+
+</%init>
\ No newline at end of file