Hallo liebe Gutefragler,

Ich möchte eine Auktions-Web-App erstellen und normalerweise fügen Sie die Auktionen über ein Formular hinzu. Wenn ich das Formular korrekt ausfülle und dann auf die Schaltfläche Auktion erstellen klicke, erhalte ich eine Fehlermeldung. Normalerweise sollte man keine bekommen und man sollte die Auktionen in einer Tabelle in einer index.html bekommen.

Hier ist mein Code:

$(document).ready(function() {
  $("#create").click(function() {
    var data = {
      seller: $("#email").val(),
      name: $("#item").val(),
      html: $("#desc").val(),
      minimum_price: $("#str").val(),
      buyout_price: $("#buyout").val(),
      created_on: Date.now(),
      duration: $("#dur").val()
    }
    $.ajax({
      type: 'POST',
      url: "http://localhost:9000/auction",
      data: data,
      dataType: "json",
      contentType: "application/json",
      error: function() {
        alert('An error occurred while creating the new auction');
      },
      success: function(data) {
        $('form :input').val('');
        alert("Good");
      }
    });
  });
});

Mein Localhost sagt:

SyntaxError: Unexpected token s in JSON at position 0

Wo ist mein Fehler? Danke im Voraus!