I am attempting to make a call to my webservice using "$http". When I use "$ajax", it works fine.
Here is an example of jQuery $Ajax working correctly:
$.ajax({
type: "Get",
crossDomain: true,
contentType: "application/json; charset=utf-8",
url: "http://localhost:60237/api/Get/Work",
data: { cdUser: 1},
dataType: "json",
success: onDataReceived,
error: onDataError
});
function onDataReceived(data) {
}
function onDataError() {
}
However, when I try to use Angular $htpp, it does not work:
app.controller('alertxxController', function ($scope, $http) {
$http({
method: 'GET',
url: 'http://localhost:60237/api/Get/Work',
params: 'cdUser=1'
}).success(function (data) {
alert("ok");
}).error(function () {
alert("error");
});
});
I'm really struggling to understand why this is not working. I can't seem to identify the error as it returns a 404 (Not Found).