{"size": 1368, "ext": "js", "max_stars_repo_path": "static/core/js/forms/new_task_form.js", "max_stars_repo_name": "ngr/fe_sm_00", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "static/core/js/forms/new_task_form.js", "max_issues_repo_name": "ngr/fe_sm_00", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "static/core/js/forms/new_task_form.js", "max_forks_repo_name": "ngr/fe_sm_00", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.8139534884, "max_line_length": 110, "alphanum_fraction": 0.4627192982}
$(document).ready(function(){
    var token = $("#token").val();

    jQuery.ajax( {
        url: 'http://aws00.grischenko.ru:8333/taskworkflows/?location_type=' + $("#location_type").val(),
        dataType: 'json',
        type: 'GET',
        beforeSend : function( xhr ) {
            xhr.setRequestHeader( "Authorization", "Bearer " + token );
        },
        success: function( data ) {
            $.each( data, function( i, item ) {
                $("<option>").attr("value", item.id).text( item.name ).appendTo( "#create_task_field_type" );
              });
        },
        error: function(){
            console.log("Couldn't load available task workflows");
        },
    } );
    
    $( "#create_task_form" ).submit(function( event ){
        payload = $("#create_task_form").serializeObject();       
        jQuery.ajax( {
            url: 'http://aws00.grischenko.ru:8333/tasks/',
            data: payload,
            type: 'POST',
            beforeSend : function( xhr ) {
                xhr.setRequestHeader( "Authorization", "Bearer " + token );
            },
            success: function(data){
                alert("Submitted");
            },
            error: function(){
                alert("Error");
            },
        });
        event.preventDefault();
    });

    
    
});
