获取ajax请求

I'm sending GET request (which returns JSON). The code looks like:

$.ajax({
  url: "http://www.new.marketprice.ru/retrieveRegions.html",
  dataType: "jsonp",
  data: {
    searchStr: request.term
  },
  error: function() {
    console.log('epic fail');
  },
  success: function( data ) {
    console.log(data);
  }
});

It returns (into console);

Resource interpreted as Other but transferred with MIME type undefined.
epic fail

But in Network tab I see GET request with returned data:

[
   { "region":"Московская область","countryId":1,
     "cityId":23,"regionId":12345,"city":"Москва","country":"Россия"},
    {"region":"Ленинградская область","countryId":1,"cityId":453,
      "regionId":54321,"city":"Санкт Петербург","country":"Россия"}
]

Why does error callback is called?


UPD

Okay, I set json and now no warning but error:

XMLHttpRequest cannot load http://www.new.marketprice.ru/retrieveRegions.html?searchStr=test. Origin http://new.marketprice.ru is not allowed by Access-Control-Allow-Origin

It's so strange because running script is located at same domain :(

It is only a json response not JSONP. Generally for JSONP the request will have callback method and response will be wrapped in that function name

Your headers don't specify the correct mime-type (application/json-p) and jQuery(?) is confused because it's not sure if it should process it as json or not.

See if you can get your server to respond with the correct type. The appropriate header is called Content-Type.

EDIT: whoops, and the OP is right, its not even JSON-P. Try changing what jquery is expecing to just 'json' first.

i was also in problem like this just try by using one more argument callback=? or json=jsonp