When I call this through ajax and check in console I see 302 found and response is the login page of my application.
In some other cases the api works fine it gives the required response when it is passed as form data.
Eg: Doesn't work
$.ajax({
url: weblink,
dataType: "json",
method: "POST",
contentType: "application/json; charset=utf-8",
data: '{"pincode" : "' + pincode + '"}',
success: function(data) {
if (data.length > 0) {
} else {
}
}});
but this: Works
$.ajax({
url: weblink,
dataType: "json",
method: "POST",
data: { "event_id": event_id },
success: function(data) {
$('.loading').remove();
$('.event_id').val(event_id);
//my code
}});
Please help.