ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

์•„์ง ํ”„๋กœ์ ํŠธ์— ์ด์šฉํ•˜๊ฒŒ ๋ ์ง€๋Š” ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ ์›น ๊ธฐ์ˆ ์„ ๊ฑฐ์˜ ๋ชจ๋ฅด๋Š” ์ƒํƒœ์—์„œ ์‹œ์ž‘ํ•œํ„ฐ๋ผ ์‹œ๊ฐ„์ด ์—„์ฒญ ๊ฑธ๋ ธ๋„ค์š” ใ… 


์ผ๋‹จ ์ œ๊ฐ€ ๊ตฌํ˜„ํ•œ ๊ฒฐ๊ณผ๋ฌผ์€ ์ด๋ ‡์Šต๋‹ˆ๋‹ค



๋”ฑ๋ณด๋ฉด ์•Œ๊ฒ ์ง€๋งŒ ์›น์‚ฌ์ดํŠธ ์ƒ์—์„œ C ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์ปดํŒŒ์ผ ๋œ ๊ฒฐ๊ณผ๋ฅผ ์ถœ๋ ฅํ•ด์ฃผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. 


๊ธฐ๋ณธ์ ์œผ๋กœ ํ•„์š”ํ•œ ํŒŒ์ผ์€ html ํ˜•ํƒœ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ํŒŒ์ผ๊ณผ html ์—์„œ ์ž…๋ ฅํ•œ ๊ฐ’์„ ์ฒ˜๋ฆฌํ•  ์„œ๋ฒ„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์ฐธ๊ณ ๋กœ ์„œ๋ฒ„์—๋Š” gcc ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์›น์ƒ์—์„œ ์ปดํŒŒ์ผ ๋œ๋‹ค๊ธฐ๋ณด๋‹ค๋Š” ๋‚ด ์ปดํ“จํ„ฐ(์„œ๋ฒ„)์—์„œ ์ปดํŒŒ์ผ ํ•˜๊ณ  ๋‚˜์˜จ ๊ฒฐ๊ณผ ๊ฐ’์„ ๋‹ค์‹œ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋„˜๊ฒจ์ฃผ๋Š” ํ˜•ํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.


์ €๋Š” ํด๋ผ์ด์–ธํŠธ ๋ถ€๋ถ„์„ pug ํ…œํ”Œ๋ฆฟ ์—”์ง„์œผ๋กœ ์ž‘์„ฑํ•œํ„ฐ๋ผ ๊ธฐ๋ณธ html ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๊ณผ๋Š” ๋ชจ์–‘์ด ์ข€ ๋‹ค๋ฆ…๋‹ˆ๋‹ค.

์ปดํŒŒ์ผ ๋˜๋Š” ๊ธฐ๋Šฅ๋งŒ์„ ์ค‘์ ์ ์œผ๋กœ ํ•˜๊ธฐ์œ„ํ•ด ๋ถ€ํŠธ์ŠคํŠธ๋žฉ ๋ถ€๋ถ„์€ ๋‹ค ๋นผ๊ณ  ๊ธฐ์žฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.



form.pug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
doctype html
html(lang='en')
    head
        script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js')
    body
            h1 ๋ฌธ์ œ
                select#language(name='language'
                    option(name='1') C
                    option(name='2') C++
                    option(name='3') Java
                p
                textarea#code(style='resize:none; width:400px; height:300px;' name='code')
                p
                input#output(type='text' name='output' style='resize:none; width:400px; height:50px;' readonly='readonly')
                p
                input#ajax_post(type = 'button' value='์ œ์ถœํ•˜๊ธฐ' class='ajaxsend')
                p
                script.
                    document.querySelector('.ajaxsend').addEventListener('click',function(){
                        sendAjax('http://localhost:3000/form_receive',code.value);
                    })    
                    function sendAjax(url,data,language){
                        var data = {'code': data};
                        data = JSON.stringify(data);
                        var xhr = new XMLHttpRequest();
                        xhr.open('POST',url,true);
                        xhr.setRequestHeader('Content-type','application/json');    
                        xhr.send(data);
 
                        xhr.addEventListener('load',function() {
                            var result = JSON.parse(xhr.responseText);
                            if(result.result !='ok')return;
                            document.getElementById('output').value=result.output;
                        });
                    }
                    script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js')
                p
cs


์œ„์—์„œ ๋งํ–ˆ๋˜ ๊ฒƒ์ฒ˜๋Ÿผ ์ด๊ฒƒ์ €๊ฒƒ ๋นผ๋‹ค๋ณด๋‹ˆ ์ด๊ฒŒ ์ •ํ™•ํžˆ ๋Œ์•„๊ฐ€๋Š” ์ฝ”๋“œ์ผ์ง€๋Š” ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ ์ฃผ์š” ๋™์ž‘๋ถ€๋ถ„์€ ๋‹ค ๊ธฐ์ˆ ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


์ผ๋‹จ ์ œ๊ฐ€ ํ•„์š”ํ•œ ๋ถ€๋ถ„์€ textarea ๋ถ€๋ถ„์— ์ž‘์„ฑ๋˜๋Š” ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค. ๊ทธ ๋ถ€๋ถ„์˜ ์ž…๋ ฅ ๋ฐ›์€ ๊ฐ’์„ ์„œ๋ฒ„๋กœ ๋„˜๊ธฐ๋Š”๋ฐ ์—ฌ๊ธฐ์„œ ์ค‘์š”ํ•œ๊ฑด Ajax ํ†ต์‹ ์œผ๋กœ ๊ฐ’์„ ๋„˜๊ฒจ์ค˜์•ผํ•œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ํ™”๋ฉด ์ด๋™์„ ํ•ด์ค˜์•ผํ•˜๋Š” ๋ถ€๋ถ„์ด ์žˆ๋Š”๋ฐ ์ €๋Š” ๊ฒฐ๊ณผ ์ฐฝ๋งŒ ๊ฐ’์„ ๋ฐ”๊พธ๊ณ  ์‹ถ์€ ์ƒํ™ฉ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ „์ฒด ํ™”๋ฉด์„ ๋ฆฌ๋กœ๋“œ ํ•˜๋Š”๊ฑด ๋ถˆํ•„์š”ํ•˜๊ธฐ๋„ํ•˜๊ณ  ๋ณด๊ธฐ์—๋„ ์ข‹์ง€ ์•Š์ฃ .


< AJAX ์˜ ํŠน์ง•>

AJAX์˜ ๊ฐ•๋ ฅํ•œ ํŠน์ง•์€ ํŽ˜์ด์ง€ ์ „์ฒด๋ฅผ ๋ฆฌํ”„๋ ˆ์‰ฌ ํ•˜์ง€ ์•Š๊ณ ์„œ๋„ ์ˆ˜ํ–‰ ๋˜๋Š” "๋น„๋™๊ธฐ์„ฑ"์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ๋น„๋™๊ธฐ์„ฑ์„ ํ†ตํ•ด ์‚ฌ์šฉ์ž์˜ Event๊ฐ€ ์žˆ์œผ๋ฉด ์ „์ฒด ํŽ˜์ด์ง€๊ฐ€ ์•„๋‹Œ ์ผ๋ถ€๋ถ„๋งŒ์„ ์—…๋ฐ์ดํŠธ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค.



ํ•ด๋‹น์ฝ”๋“œ ์ „๋ถ€์—์„œ ๋ถ€๋ถ„๋ถ€๋ถ„ ๋ฝ‘์•„์„œ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

1
input#ajax_post(type = 'button' value='์ œ์ถœํ•˜๊ธฐ' class='ajaxsend')
cs

=> '์ œ์ถœํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ajaxsend function์„ ํƒ€๋„๋ก ๋งŒ๋“  ๊ฒƒ ์ž…๋‹ˆ๋‹ค. ajax_post๋ผ๋Š” id๊ฐ’์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.


1
2
3
4
script.
    document.querySelector('.ajaxsend').addEventListener('click',function(){
        sendAjax('http://localhost:3000/form_receive',code.value);
    })
cs
=> ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ์— ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ฌ Listener ์ž…๋‹ˆ๋‹ค. ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ํ˜•ํƒœ๋กœ ๋˜์–ด์žˆ๋Š”๋ฐ ๋ฐ”๋กœ ์•„๋ž˜์—์„œ ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
function sendAjax(url,data){
         var data = {'code': data};
         data = JSON.stringify(data);
         var xhr = new XMLHttpRequest();
         xhr.open('POST',url,true);
         xhr.setRequestHeader('Content-type','application/json');    
         xhr.send(data);
 
         xhr.addEventListener('load',function() {
             var result = JSON.parse(xhr.responseText);
             if(result.result !='ok')return;
                document.getElementById('output').value=result.output;
         });
 }
cs


=> ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ url๊ณผ data ๋ฅผ ๋ฐ›๋Š” function ์ด๋‹ค. var data = { 'code' : data }; ๋ฅผ ํ•˜๊ฒŒ๋˜๋ฉด json ํ˜•ํƒœ๋กœ data ๋ณ€์ˆ˜์— ๊ฐ’์ด ๋“ค์–ด๊ฐ€๊ฒŒ ๋˜๊ณ  ๊ทธ ๊ฐ’์„ ๋‹ค์‹œ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์ธ JSON.stringify ๋ฅผ ์ž‘์„ฑํ•ด์ค๋‹ˆ๋‹ค.

url ๊ฐ’์€ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋ณด๋‚ธ ๊ฐ’์„ ์ฒ˜๋ฆฌํ•  ์„œ๋ฒ„ ์ชฝ์˜ app.post๋กœ ์ž‘์„ฑ๋œ ๋ผ์šฐํ„ฐ ์ž…๋‹ˆ๋‹ค.


XMLHttpRequest ์ด ๋ถ€๋ถ„์€ ๊ทธ๋ƒฅ ๊ทธ๋Œ€๋กœ ์จ์ฃผ๋ฉด ๋  ๋“ฏํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํžˆ ๊ณต๋ถ€ํ•œ๊ฑด ์•„๋‹ˆ์ง€๋งŒ Javascript ๋ฅผ ์ด์šฉํ•˜์—ฌ ํ†ต์‹ ์„ ํ•  ๋•Œ ํ•„์š”ํ•œ ๊ฐ์ฒด? ๋ผ๊ณ  ๋ณด๋ฉด ๋  ๋“ฏ ํ•ฉ๋‹ˆ๋‹ค. ๊ฒฐ๋ก ์ ์œผ๋กœ๋Š” POSTํ˜•์‹์œผ๋กœ data๋ฅผ ์„œ๋ฒ„์— ์ „๋‹ฌํ•ด์ฃผ๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค.


addEventListener ๋ถ€๋ถ„์€ ์„œ๋ฒ„์ชฝ์—์„œ ๋‹ค์‹œ ํด๋ผ์ด์–ธํŠธ ์ชฝ์œผ๋กœ ๊ฐ’์„ ์ „๋‹ฌํ•ด์คฌ์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” ๋ถ€๋ถ„์ž…๋‹ˆ๋‹ค. ์„œ๋ฒ„ ์ชฝ์—์„œ ์ „๋‹ฌํ•œ ๊ฐ’์„ ํ† ๋Œ€๋กœ ์กฐ๊ฑด๋ฌธ์„ ํ†ตํ•ด ์‹คํ–‰์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ํ˜•ํƒœ์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„  'ok' ๊ฐ€ ์ „๋‹ฌ๋์„ ๋•Œ ๊ฒฐ๊ณผ์ฐฝ์—๋‹ค๊ฐ€ ์ปดํŒŒ์ผ ๊ฒฐ๊ณผ ๊ฐ’์„ ์‚ฝ์ž…ํ•ด์ค๋‹ˆ๋‹ค.




app.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const express = require('express');
const parse = require('parse-json');
const app = express();
const fs = require('fs');
const spawn = require('child_process').spawn;
const bodyParser = require('body-parser');
app.set('view engine','pug');
app.set('views','./views');
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.use(express.static(__dirname + '/public'));
 
 
app.get('/form',function(req,res){
    res.render("form");
});
 
app.post('/form_receive',function(req,res) {
    var code = req.body.code;
    var source = code.split(/\r\n|\r\n/).join("\n");
    var file='test.c';
    
    fs.writeFile(file,source,'utf8',function(error) {
        console.log('write end');
    });
    var compile = spawn('gcc',[file]);
    compile.stdout.on('data',function(data) {
        console.log('stdout: '+data);
    });
    compile.stderr.on('data',function(data){
        console.log(String(data));
    });
    compile.on('close',function(data){
        if(data ==0) {
            var run = spawn('./a.out',[]);    
            run.stdout.on('data',function(output){
                console.log('์ปดํŒŒ์ผ ์™„๋ฃŒ');
                var responseData = {'result':'ok','output': output.toString('utf8')};
                res.json(responseData);
            });
            run.stderr.on('data'function (output) {
                console.log(String(output));
            });
            run.on('close'function (output) {
                console.log('stdout: ' + output);
            });
        }
    });
});
 ๋งจ ์•„๋ž˜ app.listen ๋ถ€๋ถ„ ์ƒ๋žต๋จ.. ๊นŒ๋จน์—ˆ์Šต๋‹ˆ๋‹ค ์จ์ค˜์•ผ ํ•จ
cs



=> ๋งจ ์œ„์— ์ž‘์„ฑ๋˜๋Š” app. ~~~ ์™€ ๊ฐ™์€ ์ฝ”๋“œ๋“ค์€ ํ•ด๋‹น ์ž‘์—…์—์„œ ๋‹ค ํ•„์š”ํ•œ ์ฝ”๋“œ๋“ค๋งŒ ๋‚จ๊ฒจ๋‘” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

app.get์œผ๋กœ ์šฐ๋ฆฌ๊ฐ€ ์ž‘์„ฑํ–ˆ๋˜ pug ์ฝ”๋“œ๋ฅผ render ํ•ด์ค€๋‹ค. ๊ทธ๋Ÿผ localhost:3000/form ์˜ ํ˜•ํƒœ๋กœ ์ ‘์†ํ–ˆ์„ ๋•Œ ์œ„์— ์ž‘์„ฑํ•œ html ์ฝ”๋“œ์˜ ํŽ˜์ด์ง€๊ฐ€ ๋‚˜์˜ค๊ฒ ์ฃ ?


์‹ค์ œ๋กœ ์šฐ๋ฆฌ๊ฐ€ ์ปดํŒŒ์ผํ•˜๊ณ  ๊ฒฐ๊ณผ ๊ฐ’์„ ๋‹ค์‹œ ํด๋ผ์ด์–ธํŠธ๋กœ ๋ณด๋‚ด ์ค„ ๊ณณ์€ app.post ๋ถ€๋ถ„์ž…๋‹ˆ๋‹ค.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
var code = req.body.code;
    var source = code.split(/\r\n|\r\n/).join("\n");
    var file='test.c';
    
    fs.writeFile(file,source,'utf8',function(error) {
        console.log('write end');
    });
    var compile = spawn('gcc',[file]);
    compile.stdout.on('data',function(data) {
        console.log('stdout: '+data);
    });
    compile.stderr.on('data',function(data){
        console.log(String(data));
    });
cs


=> ํด๋ผ์ด์–ธํŠธ์—์„œ ๋ณด๋‚ธ ๊ฐ’์„ ๋ณ€์ˆ˜ ๊ฐ’์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ code ๊ฐ’์„ ํ•œ๋ฒˆ ๊ฐ€๊ณตํ•ด์ค˜์•ผํ•ฉ๋‹ˆ๋‹ค. ์™œ๋ƒ๋ฉด ํด๋ผ์ด์–ธํŠธ์ชฝ์—์„œ ๋ณด๋‚ด์˜ค๋Š” ์ฝ”๋“œ๊ฐ’์€ ๊ฐœํ–‰์ฒ˜๋ฆฌ๊ฐ€ ์•ˆ๋˜๋Š” ํ˜•ํƒœ๋กœ ๋‚ ๋ผ์˜ค๋Š”๋ฐ ์ปดํŒŒ์ผ์„ ํ•˜๊ธฐ ์œ„ํ•ด์„  ์ ์–ด๋„ ๊ฐœํ–‰์ฒ˜๋ฆฌ๋Š” ๋‹ค ๋˜์–ด์•ผํ•˜๋ฏ€๋กœ ๊ทธ๋ ‡๊ฒŒ ์ฒ˜๋ฆฌํ•œ ๊ฐ’์„ ๋‹ค์‹œ source๋ผ๋Š” ๋ณ€์ˆ˜ ๊ฐ’์— ๋„ฃ๊ณ  ์šฐ๋ฆฐ ์ด ๊ฐ’์„ ์‹ค์ œ ์ฝ”๋“œ ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.


ํŒŒ์ผ์‹œ์Šคํ…œ์„ ์ด์šฉํ•˜์—ฌ source ๋ณ€์ˆ˜์˜ ๊ฐ’์„ ์†Œ์Šค์ฝ”๋“œ ํŒŒ์ผ๋กœ ์„œ๋ฒ„ ์ปดํ“จํ„ฐ์— ์ €์žฅํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  gcc ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ์ด์šฉํ•ด์„œ ์„œ๋ฒ„ ๋‚ด๋ถ€์—์„œ ๋งŒ๋“ค์–ด์ง„ ์†Œ์Šค์ฝ”๋“œ ํŒŒ์ผ์„ ์ปดํŒŒ์ผ ํ•ด์ฃผ๊ณ  ๊ทธ ํŒŒ์ผ์„ ์‹คํ–‰ํ•ด์„œ ๊ฒฐ๊ณผ ๊ฐ’์„ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
compile.on('close',function(data){
        if(data ==0) {
            var run = spawn('./a.out',[]);    
            run.stdout.on('data',function(output){
                console.log('์ปดํŒŒ์ผ ์™„๋ฃŒ');
                var responseData = {'result':'ok','output': output.toString('utf8')};
                res.json(responseData);
            });
            run.stderr.on('data'function (output) {
                console.log(String(output));
            });
            run.on('close'function (output) {
                console.log('stdout: ' + output);
            });
        }
    });
});
cs


=> ๋งˆ์ง€๋ง‰ ์ด ๋ถ€๋ถ„์—์„œ ๊ฒฐ๊ณผ ๊ฐ’์„ ๋ฐ›์•„๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ ๊ฒฐ๊ณผ๋กœ ๋‚˜์˜จ ์‹คํ–‰ํŒŒ์ผ (a.out) ์„ ์‹คํ–‰์‹œ์ผœ์„œ ๋‚˜์˜ค๋Š” ๊ฒฐ๊ณผ ๊ฐ’ (output)์„ ๋‹ค์‹œ ํด๋ผ์ด์–ธํŠธ ์ชฝ์œผ๋กœ ์ „๋‹ฌํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ „๋‹ฌํ•˜๋Š” ํ˜•ํƒœ๋Š” jsonํ˜•ํƒœ๋กœ ์ „๋‹ฌํ•˜๋ฉฐ output ์ „๋‹ฌ ์‹œ์— toString('utf8') ์„ ํ•˜์ง€ ์•Š์œผ๋ฉด bufferType ์œผ๋กœ ๊ฐ’์ด ์ „๋‹ฌ๋˜์–ด ์•„์Šคํ‚ค ์ฝ”๋“œ ๊ฐ’์œผ๋กœ ์ „๋‹ฌ์ด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ด ์ž‘์—…์„ ๊ผญ ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.


1
2
3
4
5
xhr.addEventListener('load',function() {
    var result = JSON.parse(xhr.responseText);
    if(result.result !='ok')return;
    document.getElementById('output').value=result.output;
});
cs


์•„๊นŒ ํด๋ผ์ด์–ธํŠธ์—์„œ ์„œ๋ฒ„์ชฝ์—์„œ ์ „๋‹ฌํ•˜๋Š” ๊ฐ’์„ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ถ€๋ถ„์ธ๋ฐ json ํ˜•ํƒœ์˜ ์ „๋‹ฌ๋˜๋Š” ๊ฐ’ ์ค‘์—์„œ ์ฒซ ๋ฒˆ์งธ ๊ฐ’์ธ result์˜ ๊ฐ’์ด ok ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด return ; ์ฆ‰ ์•„๋ฌด ์ž‘์—…๋„ ํ•˜์ง€ ์•Š๊ณ  ok์ผ ๋•Œ์—๋งŒ output์ด๋ผ๋Š” textarea์— ์ปดํŒŒ์ผ์˜ ๊ฒฐ๊ณผ ๊ฐ’์„ ์—…๋ฐ์ดํŠธ ์‹œ์ผœ์ฃผ๋ฉด ๋!


Ajax๋ž‘ json์— ์ต์ˆ™์น˜๊ฐ€ ์•Š์•„์„œ ์ •๋ง ์• ๋จน์€ ์ž‘์—…์ด์—ˆ๋„ค์š”.... ํ•„์ˆ˜์ค‘์— ํ•„์ˆ˜๋‹ˆ๊นŒ ๋” ์—ฐ์Šตํ•ด์•ผ๊ฒ ๋„ค์š” ใ… 


๋Œ“๊ธ€
๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
ยซ   2024/12   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
๊ธ€ ๋ณด๊ด€ํ•จ