either crossdomain error or token error, I cannot get data from REST API, Please HELP RRS feed

  • Question

  • I am using location API, to Get the latitude and longitude coordinates based on a set of address values

    If I use simple json I get the "No 'Access-Control-Allow-Origin'" error. If I use jsonp I get "Unexpected token :" error

    	url: encodeURI (''),
          type: "GET",
          dataType: 'jsonp',
    	  jsonp: "callback",
    	  success: function(r) {
    	var lat=r.resourceSets[0].resources[0].point.coordinates[0],
          error: function(response) {

    The above throws Uncaught SyntaxError: Unexpected token :

    If I change datatype to json, I get "XMLHttpRequest cannot load http…=json&key=... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

    What should I do to get the result?

    Wednesday, June 21, 2017 3:27 PM


  • I believe the jsonp parameter needs to be set to jsonp and not callback. Here is a sample

    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Thursday, June 22, 2017 4:08 AM
    • Marked as answer by JrDai Sunday, June 25, 2017 1:57 PM
    Thursday, June 22, 2017 4:08 AM