Below is a angular service I created to return search results from Indeed job search api:
(function() {
"use strict";
angular
.module("career.resources")
.factory("JobSearchService", ["$http", jobsearchService]);
function jobsearchService($http) {
return{
getSearchResults: getSearchResults
};
function getSearchResults(publisherKey,keywords,location,jobType,limit) {
return $http.get("http://api.indeed.com/ads/apisearch?", {params: {
"publisher": publisherKey,
"v": "2",
"format": "json",
"callback": "JSON_CALLBACK",
"q": keywords,
"l": location,
"sort": "",
"radius": "",
"st": "",
"jt": jobType,
"start": "0",
"limit": limit,
"fromage": "",
"highlight": "1",
"filter": "1",
"userip": "1.2.3.4"
}});
}
}
}());
When ever this call http request is made i get the following error:
XMLHttpRequest cannot load (url). No 'Access-Control-Allow-Origin' header is present on the requested resoure. Origin 'http://localhost:62510' is therefore not allowed access
Is there a way to bypass this, since I have a api key, to get back data?
I've also unsuccessfully attempted this via a $http.jsonp call here
UPDATED I've tried to accomplish this via $.ajax call also but this happens outside the scope of angular and the data never gets saved to the scope variable.