I was trying to post an empty array using ajax call, but the data is posted as an empty string i.e. Parts: . I want the data to be posted as Parts:[] which is not happening because the webservice handles empty collection only ie Parts[].
Code:
var parts=[];
$.ajax({
type: "POST",
url: "http://api-test.example.com",
dataType: "json",
headers:{Authorization:authHeader},
data: "Parts="+parts,
success: function (result) {
},
error: function (result){
}
});
Any idea of how to fix this?