I have a link that looks like this :
//GetAll
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "GetAll/{Token}", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare )]
List<DataModal.Main.Company > GetAll(string Token);
And I'm trying to consume this with jQuery Ajax, and I've made something like this:
$("#btnCom").click(function(){
$.ajax({
type: "POST", //REQUEST TYPE
dataType: "json", //RESPONSE TYPE
url: "http://ws/method/token", // URL OF THE WS
success: function(data) {
$.each(data, function(i) {
if (data.length != i) {
$('#list').append("<option>" + data[i].Name + "</option>"); //fILL THE DDL. FOR EACH ITEM RETURNED ADD DATA[NAME] TO ONE LINE OF THE DDL.
}
});
},
error: function(err) {
console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
}
}).always(function(jqXHR, textStatus) {
if (textStatus != "success") {
alert("Error: " + jqXHR.statusText);
}
})
});
But i think that a POST request that returns some data cannot be consumed here and I cannot fins any solutions for me.
Can anybody help me?
UPDATE: