JSFiddle - React, Tailwind, and code Playground
JavaScript
let bin = {
name: 'John Doe',
age: 21,
hobbies: ['Football', 'Stamp Collection']
}
$.ajax({
url: 'https://api.jsonbin.io/b/5b20b72366841d47e37b7f3e',
type: 'PUT',
contentType: 'application/json',
/* headers required ONLY if you are creating a private bin or you want to create a public bin
and also list the same in your account by passing private: false */
headers: {
'secret-key': '$2a$10$gtBni.tyVAK2ZnF.feNwGuqFDpa079d12/lPliwVYUCHWpjqcmT6i'
},
data: JSON.stringify(bin),
success: (data) => {
console.log(data);
},
error: (err) => {
console.log(err.responseJSON);
}
});