As I have declared success and error ajax options, where the response is 204, the ajax method goes to option success which leads to an error.
As per the documentation we