I want to create a new task in Redmine via jQuery. I tried the code below, but without success.
function createIssue() {
var payload = {
"issue": {
"project_id": 127,
"subject": "Example",
"tracker_id": 208,
"priority_id": 4
}
}
var RedMine_Root = "http://xxxxxxxxxxxxxxxxxxxxxx/redmine";
$.ajax({
type: "POST",
dataType: 'jsonp',
contentType: "application/json",
data: payload,
url: RedMine_Root + "/issues.json",
}).done(function (data) {
console.log("ok");
})
.fail(function (jqXHR, textStatus, err) {
$('#tarefa').text('Error: ' + err);
});
}
When you click the button nothing happens. How do I use the above function? How do you authenticate?