I want to perform an ajax call with parameters. I want to send the paramters as json or as text if this is possible.
The result is returned as html content type.
So this is what I tried
var data2 = {
'some-id': 5
};
$.ajax({
type: "POST",
url: /* some url */,
data: JSON.stringify(data),
dataType: 'json',
success: function(data){
//some logic
}
}).fail(function() {
//some error logic
});
The problem is, that the ajax fails with the message "undefined" because it expects html as response, however my action returns html.
How can I make this to work with html response?