ajax 동기방식 적용
2021. 1. 21. 22:57ㆍJavascript
async: false 추가
$.ajax({
url : "{% url 'gantt:getData' %}",
data : {
"work_id" : "{{work_id}}"
},
dataType : 'json',
async: false,
success : function(data) {
console.log('getData 0')
data = JSON.parse(data);
var tasks = new Array();
$.each(data, function(i,item) {
console.log(i,item);
newProject();
fields = item.fields;
var task = new Object();
task.id = item.pk;
task.name = fields.name;
task.code = fields.code;
task.level = fields.level;
task.start = new Date(fields.start).getTime();
task.end = new Date(fields.end).getTime();
task.duration = fields.duration;
task.collapsed = (fields.collapsed=='1');
task.progress = fields.progress;
task.relevance = fields.relevance;
task.type = fields.type;
task.typeId = fields.type_id;
task.description = fields.description;
task.status = fields.status;
task.depends = fields.depends;
task.startIsMilestone = (fields.start_is_milestone=='1');
task.endIsMilestone = (fields.end_is_milestone=='1');
task.canWrite = (fields.can_write=='1');
task.canAdd = (fields.can_add=='1');
task.canDelete = (fields.can_delete=='1');
task.canAddIssue = (fields.can_add_issue=='1');
task.hasChild = (fields.has_child=='1');
task.assigs = fields.assigs;
tasks.push(task);
console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaa",(fields.start_is_milestone=='1'))
console.log(task.canWrite)
});
'Javascript' 카테고리의 다른 글
canvas size가져오기, resize (0) | 2021.01.23 |
---|---|
tiff 파일 브라우져에서 보이기 (0) | 2021.01.23 |
날짜 밀리세컨드 값 얻기 (0) | 2021.01.17 |
브라우져에서 콘솔로 로그 출력 (0) | 2021.01.15 |
focus 객체 확인하기 (0) | 2021.01.15 |