{"size": 899, "ext": "js", "max_stars_repo_path": "public/js/chapterEdit/chapter-title-update.js", "max_stars_repo_name": "Lospitao/myphpisland", "max_stars_repo_stars_event_min_datetime": "2020-09-02T07:05:45.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-02T07:05:45.000Z", "max_issues_repo_path": "public/js/chapterEdit/chapter-title-update.js", "max_issues_repo_name": "Lospitao/myphpisland", "max_issues_repo_issues_event_min_datetime": "2020-08-17T16:34:57.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T12:12:46.000Z", "max_forks_repo_path": "public/js/chapterEdit/chapter-title-update.js", "max_forks_repo_name": "Lospitao/myphpisland", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 201, "max_forks_count": null, "avg_line_length": 28.09375, "max_line_length": 91, "alphanum_fraction": 0.5205784205}

$(document).ready(function() {

    let chapterTitle = document.getElementById("chapter-title");
    let chapterUuid = chapterTitle.getAttribute("data-uuid")

    let updateLessonWebService = API_DOMAIN + '/api/v1/chapters/' + chapterUuid + '/title';



    $('#chapter-title').focusout(function() {
        let chapter_title_text = $('#chapter-title').val();
        $.ajax({
            url : updateLessonWebService,
            data : {
                'chapter_title' : chapter_title_text,
            },
            type : 'PATCH',
            dataType : 'json',
            success: function (data) {
                console.log('Submission was successful.');
                console.log(data)

            },
            error: function (data) {
                console.log('An error occurred.');
                console.log(data['stageUuidDevuelto']);
            },
        })
    });
});
