0

The error message I keep getting is:

POST url 422 (UNPROCESSABLE ENTITY)

$.ajax({
  url: 'url',
  type: "POST",
  contentType: "application/json",
  complete: 'callback',
  skip_before_action: "verify_authenticity_token" ,
  data: JSON.stringify({
    "Name": name,
    "Vorname": vorname,
    "Passwort": Passwort,
    "E-Mail":Mail
  }),
  success: function(data){
     $('#body').html(data.msg);
  }
});
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
reposter
  • 33
  • 1
  • 1
  • 7
  • That error is coming from your server. It's possible that the server is not expecting a JSON payload. You need to check the documentation of the endpoint to determine what the correct request data type should be. Also note that `skip_before_action` is not a valid property of `$.ajax()`, and `complete` should be a function reference, not a string. Neither of those are immediate to your issue, though – Rory McCrossan Aug 23 '17 at 08:42
  • thx for the fast answer – reposter Aug 23 '17 at 08:44
  • I'd suggest to include the csrf token in the request data. See for example https://stackoverflow.com/questions/32738763/laravel-csrf-token-mismatch-for-ajax-post-request – Adrian Hernandez-Lopez Jun 11 '18 at 08:00

0 Answers0