Reputation: 10298
I have this simple page that just needs to show contents that is loaded from an external url (ajax request, response in json format)
I should say I'm a AngularJS newbie.
I've googled a bunch and found different ways of doing this and couldn't manage to determine which is the correct/simple/up-to-date way to achieve this.
My 2 challenges -
Here is my attempt. I know that the ajax request is never made because its not setup correctly.
Upvotes: 0
Views: 588
Reputation: 9362
You are getting into .error function: http://jsbin.com/oDUsuVA/3/edit
For jsonp your response should be something like:
callback([
{
"title":"License Title 1",
"licenseUrl":"http://cnn.com",
"licenseText": " test"
}]);
Edit: You can simply do .get() request too, but if you had to use jsonp request interface, you would have to correct response.
A Jsonp request always wraps the logic into a json callback wrapper function.
Upvotes: 1
Reputation: 19588
I just did $http.get
instead of your $http.jsonp
and it did work for me.
Upvotes: 0