I'm encountering an issue while trying to send a request using AJAX. The request is successful when I use the following webservice: https://jsonplaceholder.typicode.com/users
However, when I attempt to make the same request with my own service, I face difficulties in working with the response data. Below is an example of how my function looks:
$(document).ready(function() {
$.ajax({
type: "GET", //REQUEST TYPE
dataType: "JSONP", //RESPONSE TYPE
url: "http://mywebservice/method/", // URL OF THE WS
success: function(data){
console.log(data);
var i=0;
$.each(data,function(i){
if(data.lenth != i){
$('#lista_divisions').append("<option>"+data[i].Name+"</option>"); //fILL THE DDL. FOR EACH ITEM RETURNED ADD DATA[NAME] TO ONE LINE OF THE DDL.
}
});
}
});
});
Upon inspecting the console on the website, no errors are being displayed. Can anyone provide assistance in resolving this issue?
NETWORK TAB:
https://i.sstatic.net/WKZDh.png
JSON RESPONSE
[{"DateAdd":"/Date(1508694576287+0100)/","DateAlter":"/Date(1508694576287+0100)/","DivisionId":1,"Name":"Norte ","UserAdd":"LoadData","UserAlter":"LoadData","UtlIns":null},{"DateAdd":"/Date(1508694576287+0100)/","DateAlter":"/Date(1508694576287+0100)/","DivisionId":2,"Name":"Sul ","UserAdd":"LoadData","UserAlter":"LoadData","UtlIns":null}]