$scope.addTodo = function() {
var url = 'http://services.postcodeanywhere.co.uk/PostcodeAnywhere/Interactive/Find/v1.10/json2.ws?Key=XE97-xXxx-YG99-JK92&SearchTerm=12345&PreferredLanguage=English&Filter=&UserName=&CallbackFunction=a';
var config1 = {headers:{
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods': ['OPTIONS', 'GET', 'POST'],
'Access-Control-Allow-Headers':'Origin, X-Requested-With, Content-Type, Accept',
'Content-Type':'text/plain; charset=utf-8',
'Accept':'*/*'
}};
// alert("hello");
alert("url" + url);
//Enable cross domain calls
$http.defaults.useXDomain = true;
// alert("$http.defaults.useXDomain");
//Remove the header used to identify ajax call that would prevent CORS from working
delete $http.defaults.headers.common['X-Requested-With'];
// alert("$http.defaults.headers.common");
// alert("$http.config1"+config1);
// alert("url" + url);
$http.get(url, config1).success(function (data, status, headers, config) {
alert("success");
if(data.success){
alert("inside success");
}else{
alert("inside else");
}
}).
error(function (data, status, headers, config) {
alert("Error, please report to admin. Error code is " + status);
//alert("data, please report to admin. Error code is " + data);
});
};