86774

Cross Domain Ajax get Request

I'd like to ask a question for cross-domain Get request via Ajax. My ajax request is Like that

var currency_path="http://forex.cbm.gov.mm/api/latest"; $.ajax({ url: currency_path, crossDomain:true, type:"GET", dataType:'jsonp', async:false, success: function(data){ console.log(data); }, error: function(){ alert('failure'); } }).done(function(msg) { console.log(msg); });

I got the response but i can't trace that Any Suggestion ?

Answer1:

Look in your JavaScript error console:

Uncaught SyntaxError: Unexpected token :

You have dataType:'jsonp', but the URL is returning JSON.

You can't parse JSON as JSONP, there are different data formats.

Use some other technique to access the data.

Recommend

  • Silverlight-to-WCF cross-domain exception, but clientaccesspolicy.xml is being read successfully
  • Build a dynamic table using array data generated from PHP in JSX/React
  • What to do when an API doesn't allow Access-Control-Allow-Origin
  • The request sent by the client was syntactically incorrect
  • jQuery random blockquote
  • A simple datepicker in VueJS
  • is there a way to update filter with async data
  • Get localized short date pattern as String?
  • Authentication failed with Azure Active Directory in Windows Phone
  • In loopback documentation what does variable 'cb' stands for?
  • How to get links to open in the native browser in iOS Meteor apps?
  • ThreadStatic in asynchronous ASP.NET Web API
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • gspread or such: help me get cell coordinates (not value)
  • Parse a date string in a specific locale (not timezone!)
  • How to attach a node.js readable stream to a Sendgrid email?
  • Get data from AJAX - How to
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • Bug in WPF DataGrid
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Hazelcast - OperationTimeoutException
  • RestKit - RKRequestDelegate does not exist
  • Circular dependency while pushing http interceptor
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Revoking OAuth Access Token Results in 404 Not Found
  • AngularJs get employee from factory
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How to set the response of a form post action to a iframe source?
  • How do I configure my settings file to work with unit tests?
  • Change div Background jquery
  • How to stop GridView from loading again when I press back button?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • How can I use `wmic` in a Windows PE script?