JSFiddle - React, Tailwind, and code Playground
by dshilkret
JavaScript
function createListItem(itemProperties, success, failure) {
$.ajax({
url: "https://sbrokers.onmicrosoft.com/_vti_bin/listdata.svc/List2",
type: "POST",
processData: false,
contentType: "application/json;odata=verbose",
data: JSON.stringify(itemProperties),
headers: {
"Accept": "application/json;odata=verbose"
},
success: function(data) {
success(data.d);
},
error: function(data) {
// failure(data.responseJSON.error);
alert("error");
}
});
}
var Title = "Title";
var Name= "Answer";
var taskProperties = {
'Title': Title,
'Answer': Name
};
createListItem(taskProperties, function(task) {
alert("Thank you for your input!");
},
function(error) {
console.log(JSON.stringify(error));
}
);