0
私は角度JSでzillow APIを使用してURLを取得しようとしています。AngularJS JSONP TypeError:url.replaceは関数ではありません
angular.module('account.settings').controller('AccountSettingsCtrl', ['$scope', '$http', '$sce',
function($scope, $http, $sce) {
var getZillowURL = function() {
var url = "http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=X1-ZWz1ft20wfj30r_94p25&address=2114+Bigelow+Ave&citystatezip=Seattle%2C+WA";
var trustedUrl = $sce.trustAsResourceUrl(url);
$http.jsonp(trustedUrl, {
jsonpCallbackParam: 'callback'
})
.success(function(result) {
$scope.mortgageLocation = result;
console.log('success!');
console.log(result);
})
.error(function(data, status) {
console.log('error!');
console.log(data);
});
};
getZillowURL();
}
]);
しかし、JSONPはエラーを返します。 JSONPパラメータとして使用されているURLでアクセスすると、Webブラウザが正しく表示されます。 このzillow APIはXMLデータを返します。 これをJSONタイプのデータとして取得するにはどうすればよいですか?
のようにJSONに変換あなたの質問**のURLは** JSONPをサポートするリソースではありません – Phil