Ich habe folgende Informationen:vorgehen POST mit jQuery.ajax
URL: POST https://api.recman.no/post/
Typ: JSON
POST/post/HTTP/1.1
Inhalt-Typ: anwendung/json
{
"key": "YOUR_KEY",
"scope": "candidate-import",
"data": {
"corporationId": 2,
"firstName": "Johnny",
"lastName": "Bravo",
"title": "CTO"
}
}
Was ist der beste Weg, um eine Ajax Post Anfrage mit dieser jQuery zu schreiben?
Der folgende Code nur mich gibt "Fehler":
API spesific Dokumentation finden Sie unter https://help.recman.no/help/candidate-import-via-api/ und jQuery.ajax() Dokumentation bei http://api.jquery.com/jquery.ajax/
UPDATE 1 gefunden werden. (Key wird aus Sicherheitsgründen entnommen)
data = {
"key": "**********",
"scope": "candidate-import",
data: {
"corporationId": 2,
"firstName": "Johnny",
"lastName": "Bravo",
"title": "CTO"
}
}
jQuery.ajax({
type: "POST",
url: "https://api.recman.no/post/",
contentType: "application/json",
dataType: "json",
data: data,
success: function(data, status, jqXHR) {
alert(status);
},
error: function(jqXHR, status) {
// error handler
alert(status);
}
});
Mögliche Duplikat [Jquery Ajax Posting json zu webservice] (http://stackoverflow.com/questions/6323338/jquery-ajax-posting-json-to-webservice) – Igor
Haben Sie die jquery Postdocs sehen? Was sind Ihre Probleme, wenn Sie versuchen, dem Beispiel in der Dokumentation zu folgen? – epascarello
Wenn ich wüsste, wie man es schreibt, hätte ich die Frage nicht gestellt. Wo passt mein Json-Beispiel in die '$ .ajax ({});' Funktion? – iamchriswick