Note that there are some explanatory texts on larger screens.

plurals
  1. POWeird exception on createHttpBackend when doing an $http.get
    primarykey
    data
    text
    <p>I'm just getting started on AngularJS and for some reason I'm having a problem. I'm running an http get query to the Last.fm API in order to retrieve similar artists to Caravan. I have tried the query on a web browser and it returns the correct XML response.</p> <p>This is my controller:</p> <pre><code>function ArtistsCtrl($scope, $http) { //artist: $scope.artist; $scope.getArtists = function() { $http.get('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&amp;artist=Caravan&amp;api_key=MY_API_KEY').success(function(data) { echo(data); }).error(function(data, status, headers, config){ echo(data); }); }; }; </code></pre> <p>And this is my view: </p> <pre><code>&lt;!doctype html&gt; &lt;html lang="en" ng-app&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;My HTML File&lt;/title&gt; &lt;link rel="stylesheet" href="css/app.css"&gt; &lt;link rel="stylesheet" href="css/bootstrap.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div ng-controller="ArtistsCtrl"&gt; &lt;button ng-click="getArtists()"&gt;Get artists&lt;/button&gt; &lt;/div&gt; &lt;script src="angular.js"&gt;&lt;/script&gt; &lt;script src="angular-resources.js"&gt;&lt;/script&gt; &lt;script src="app.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The problem is that when I click on the button and it executes $http.get, it throws the following exception and never returns any data. </p> <pre><code>[Exception... "" nsresult: "0x805e0006 (&lt;unknown&gt;)" location: "JS frame :: http://localhost/AngularJS/angular.js :: createHttpBackend/&lt; :: line 9409" data: no] http://localhost/AngularJS/angular.js Line 5764 </code></pre> <p>Anyone has any idea about what could be the problem? Thanks. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload