0

I have been reading about this jsonp method and i just don't get it and i dont know what to fix.

here's my code

$(document).ready(function() {
$.getJSON( 'http://nutri.de.imerchmedia.com/services/accounts', function(data ) {
$('#select').append("<option value='0' name='idsel'>Select Outlet</option>");
console.log(data);
$.each(data, function (i, item) {
$('#select').append("<option value='" + item.outlet_group_id + "'>" +
item.outlet_group_name + " : " + item.outlet_group_code + "</option>");
});
});
});

I hope someone could help me, it's been 2days >.<

and if i use this

var url = "http://nutri.de.imerchmedia.com/services/accounts";
    $.ajax({
    url: url,
    type: 'GET',
    dataType: "jsonp",
    success: function(data){
      console.log(data);
    }
    });

i always get this Resource interpreted as Script but transferred with MIME type text/html: "http://nutri.de.imerchmedia.com/services/accounts?callback=jQuery1102006321510183624923_1380442924579&_=1380442924580".

A Super Awesome
  • 93
  • 1
  • 1
  • 7
  • possible duplicate of [Ways to circumvent the same-origin policy](http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy) – Quentin Sep 29 '13 at 08:19
  • check this http://stackoverflow.com/questions/5943630/basic-example-of-using-ajax-with-jsonp – S4beR Sep 29 '13 at 11:11

1 Answers1

0

Try setting crossDomain: true in the ajax parameters to force cross-domain requests.

Rajesh
  • 3,743
  • 1
  • 24
  • 31