Can I copy this code in my AngularJS APP. I'm new in AngularJS and I want to know. If I can copy this code done in javascript in my AngularJS APP
function callWS(url, type, dataType, data) {
var resultado = '';
$.ajax({
url: url,
type: type,
dataType: dataType,
contentType: "application/json; charset=utf-8",
data: data,
async: false,
success: function(data) {
resultado = data;
},
error: function(e, msg) {
console.log(msg + ' en ws ' + url);
}
});
return resultado;
}
$http
service in angular..Not$.ajax
..The $http service is a core Angular service that facilitates communication with the remote HTTP servers via the browser's XMLHttpRequest object or via JSONP.