Skip to Content

Google maps API with OpenUI5 CORS error

Dear Gurus

I was trying to create an app that displays user address based on his coordinates with google maps api the code is working fine inside eclipse ide but when i hos it on IIS i receive the following error

XMLHttpRequest cannot load,31.176554&sensor=true&key=AIzaSyCEZN8UB34nbx3D-17xk1J-DRnNCF_kjm4. Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.

And my code is below

var position = null;
				if (navigator.geolocation) {
					navigator.geolocation.getCurrentPosition(function(aPosition) {
						position = aPosition;"sap.m.MessageToast");
						$.sap.log.error("LAT:" + position.coords.latitude + " LON:" + position.coords.longitude);
						var oGeoModel = new sap.ui.model.json.JSONModel();
						var aData = jQuery.ajax({
							type: "GET",
							contentType: "application/json",
							url: "" + position.coords.latitude + "," + position.coords.longitude +
							dataType: "json",
							async: false,
							crossDomain: true,
							success: function(data, textStatus, jqXHR) {
									modelData: data
								//alert("success to post");
				} else {"Sorry, your browser does not support geolocation services.");

Any help would be appreciated

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers