I have the following information:
URL: POST https://api.recman.no/post/
Type: JSON
POST /post/ HTTP/1.1
Content-Type: application/json
{
"key": "YOUR_KEY",
"scope": "candidate-import",
"data": {
"corporationId": 2,
"firstName": "Johnny",
"lastName": "Bravo",
"title": "CTO"
}
}
What is the best way to write a Ajax post request with this using jQuery?
API spesific documentation can be found at https://help.recman.no/help/candidate-import-via-api/ and jQuery.ajax() documentation at http://api.jquery.com/jquery.ajax/
UPDATE 1:
The following code just gives me "error". (Key is taken out for security reasons)
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);
}
});