angularJS: http request configuration url must be a string
<p>I have a function that takes an input from the front-end, and then concatinates that input into an URL that I want to get from wikipedia. Since I had problems with CORS, I implemented my $http.get as JSONP, and now I get the following error:</p>

<blockquote>
  <p>angular.js:13236 Error: [$http:badreq] Http request configuration url
  must be a string.  Received:
  {"method":"JSONP","url":"<a href="https://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;uselang=user&amp;prop=extracts%7Cpageimages&amp;titles=Maya+Angelou&amp;piprop=name%7Coriginal" rel="noreferrer">https://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;uselang=user&amp;prop=extracts%7Cpageimages&amp;titles=Maya+Angelou&amp;piprop=name%7Coriginal</a>"}</p>
</blockquote>

<p>The thing is, that his error shows the concatinated url as a string?</p>

<p>Can anybody point out what I'm doing wrong?</p>

<p>This is the function I am calling:</p>

<pre><code>//function to get author info from wikipedia
$scope.getAuthorInfo = function(author) {
    //remove whitespace from author
    author = author.replace(/\s/g, '+');
    //concat the get URL
    var url = 'https://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;uselang=user&amp;prop=extracts%7Cpageimages&amp;titles=' +
        author + '&amp;piprop=name%7Coriginal';
    //get author info from wikipedia    
    $http.get({
            method: 'JSONP',
            url: url
        })
        .then(function successCallback(response) {
            $scope.author = response.data;
            //for every result from wikipedia, trust the extract as html
            for (var x in $scope.author.query.pages) {
                $scope.author.query.pages[x].extract = $sce.trustAsHtml($scope.author.query.pages[x].extract);
            }

        }, function errorCallback(response) {
            console.log(response);
        });
};
</code></pre>

<p>If you need additional information, please let me know.</p>