<div dir="ltr"><div><div><div>Dears,<br><br></div><div>Firstly, thanks to all contributors of OSM!<br></div><div><br></div>I have setup OSRM engine on CentOS VM (<a href="https://github.com/Project-OSRM/osrm-backend/wiki">https://github.com/Project-OSRM/osrm-backend/wiki</a>) and if I query it via browser directly it is working fine, returning route.json file.<br><br></div>My problem is that I can't get it working via Javascript. Getting below error if i query it from my website:<br><br>var resultJSON = {};    <br><br>$.ajax({            <br>    dataType: "json",<br>    async: false,<br>    cache: true,<br>    url: <span style="background-color:rgb(255,255,0)">'<a href="http://192.168.137.50:5000/viaroute?geometry=true&loc=42.25899995,42.667269338144&loc=42.2695544,42.7017228">http://192.168.137.50:5000/viaroute?geometry=true&loc=42.25899995,42.667269338144&loc=42.2695544,42.7017228</a>'</span><br>    success: function(data) {<br>    resultJSON = data;<br>    }<br>});<br><br></div><b>Error:</b><br><div><span style="background-color:rgb(255,255,0)"><i><span class=""><span class="">"Cross-Origin
 Request Blocked: The Same Origin Policy disallows reading the remote 
resource at 
<a href="http://192.168.137.50:5000/viaroute?geometry=true&loc=42.25899995,42.667269338144&loc=42.2695544,42.7017228">http://192.168.137.50:5000/viaroute?geometry=true&loc=42.25899995,42.667269338144&loc=42.2695544,42.7017228</a>.
 (Reason: CORS header 'Access-Control-Allow-Origin' missing)."<br><br></span></span></i></span></div><div><span style="background-color:rgb(255,255,0)"><span style="background-color:rgb(255,255,255)"><span class=""><span class="">As</span></span><span class=""><span class=""> stated in APi manual, </span></span></span></span><span style="background-color:rgb(255,255,0)"><span style="background-color:rgb(255,255,255)"><span class=""><span class=""><code>jsonp={callback name} <span style="font-family:arial,helvetica,sans-serif">must be added to request URL, which is not helping either. Tried different variations with jsonp, cache (which is adding extra _ parameter to the URL), getJson method, crossdomain : true ...Thinking to read the json on server side via PHP<i> file_get_contents</i> and then send it to front end via json, but can't get it working either. I believe there must be more smooth way as it is mentioned in the API manuals.<br><br></span></code></span></span></span></span></div><div><span style="background-color:rgb(255,255,0)"><span style="background-color:rgb(255,255,255)"><span class=""><span class=""><code><span style="font-family:arial,helvetica,sans-serif">I would really appreciate if anyone can help me with a working code.<br></span></code></span></span></span></span></div><div><span style="background-color:rgb(255,255,0)"><i><span class=""><span class=""></span></span></i></span></div><div><span style="background-color:rgb(255,255,0)"><i><span class=""><span class=""><br><br></span></span></i></span></div><div><span style="background-color:rgb(255,255,255)"><span class=""><span class="">Br,<br></span></span></span></div><div><span style="background-color:rgb(255,255,0)"><span class=""><span class=""><span style="background-color:rgb(255,255,255)">Sergi</span></span></span><i><span class=""><span class=""><br></span></span></i></span></div></div>