1

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?

  • Due to the same origin policy, this will only work if your jQuery script runs on the same URL host as your Redmine. Your console log in your browser will show you details about this. – Holger Just May 30 '16 at 08:18

0 Answers0