반응형
function drawRamPieChartAjax(){

	return new Promise((resolve,reject) =>{
	$.ajax({
		url: "pie-charat",
		type: 'GET',
		success: function(data) {
			initRamPieChart();

			let totalRamSize = data.total_ram;
			let freeRamSize = data.free_ram;
			let usedRamSize = totalRamSize - freeRamSize;

			drawRamPieChart(usedRamSize, freeRamSize);

			resolve("sucess");
		}, //success end
		error : function (error) {
			alert(error.status);       // 에러코드 
			alert(error.responseText); // Error 메시지 
		}, // error end
		complete : function (){
			alert("finally");
		}
	}); //ajax end	
	}); // promise end
}
반응형