home2 ๊ฒŒ์‹œํŒ Node.js, Express ๊ฒŒ์‹œํŒ ์‚ญ์ œ์š”์ฒญ2

์‚ญ์ œ์š”์ฒญ2

  • ์ด ์ฃผ์ œ์—๋Š” 4๊ฐœ ๋‹ต๋ณ€, 2๋ช… ์ฐธ์—ฌ๊ฐ€ ์žˆ์œผ๋ฉฐ codingapple๊ฐ€ 3 ๋…„, 3 ์›” ์ „์— ์ „์— ๋งˆ์ง€๋ง‰์œผ๋กœ ์—…๋ฐ์ดํŠธํ–ˆ์Šต๋‹ˆ๋‹ค.
5 ๊ธ€ ๋ณด์ž„ - 1 ์—์„œ 5 ๊นŒ์ง€ (์ด 5 ์ค‘์—์„œ)
  • ๊ธ€์“ด์ด
    ๊ธ€
  • #46960

    ์ฟ ์•™
    ์ฐธ๊ฐ€์ž
    $.ajax({ method : 'DELETE', url : '/delete', data : { _id : 1 } }).done(function(๊ฒฐ๊ณผ){  })
    
    ์—ฌ๊ธฐ๊นŒ์ง€๋Š” ์‹คํ–‰์ด ์ž˜๋˜๋Š”๋ฐ
    
    $('.delete').click(function(){ $.ajax({ method : 'DELETE', url : '/delete', data : { _id : 1 } }).done(function(๊ฒฐ๊ณผ){  })
    ์ด๋ ‡๊ฒŒ ์ œ์ด์ฟผ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ๋ถ€ํ„ฐ 
    
    
     server.js ์— ์žˆ๋Š”
    app.delete("/delete", function (์š”์ฒญ, ์‘๋‹ต) {
      console.log(์š”์ฒญ.body);
      ์š”์ฒญ.body._id = parseInt(์š”์ฒญ.body._id);
      db.collection("post").deleteOne(์š”์ฒญ.body, function (์—๋Ÿฌ, ๊ฒฐ๊ณผ) {
        console.log("์‚ญ์ œ์™„๋ฃŒ");
      });
      ์‘๋‹ต.send("์‚ญ์ œ์™„๋ฃŒ");
    });
     
    console.log ๋ถ€๋ถ„๋„ ํ„ฐ๋ฏธ๋„์— ์•ˆ๋œจ๊ณ 
    ์ด๋ถ€๋ถ„์„ ์ธ์‹์„ ๋ชปํ•˜๊ณ  ์‹คํ–‰์„ ๋ชปํ•ฉ๋‹ˆ๋‹ค. ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ•˜๋‚˜์š”?
    #46961

    ์ฟ ์•™
    ์ฐธ๊ฐ€์ž
     $('.delete').click(function(){}
    ์ด๊ณณ์— ๋„ฃ์œผ๋ฉด ์ธ์‹์„ ์•ˆํ•˜๋Š”๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค
    #46977

    codingapple
    ํ‚ค ๋งˆ์Šคํ„ฐ
    ์‘๋‹ต.send๋ฅผ deleteOne ์ฝœ๋ฐฑํ•จ์ˆ˜์•ˆ์œผ๋กœ ์˜ฎ๊น์‹œ๋‹ค
    #46990

    ์ฟ ์•™
    ์ฐธ๊ฐ€์ž
    ์•ˆ๋ฉ๋‹ˆ๋‹ค..
    
    $(".delete").click(function () { });
    
    ์•ˆ์—  $.ajax({
              method: "DELETE",
              url: "/delete",
              data: { _id:  1},
            }).done(function (๊ฒฐ๊ณผ) {
              //AJAX ์„ฑ๊ณต์‹œ ์‹คํ–‰ํ•  ์ฝ”๋“œ๋Š” ์—ฌ๊ธฐ
            });
    
    ์ฝ”๋“œ๋ฅผ ๋„ฃ์œผ๋ฉด ์ธ์‹์ด ์•ˆ๋ฉ๋‹ˆ๋‹ค.
    #47057

    codingapple
    ํ‚ค ๋งˆ์Šคํ„ฐ
    $(".delete").click(function () { });
    ์œ„์น˜๋„ html ํ•˜๋‹จ์— ์ž˜ ์ ์—ˆ๋‚˜ ํ™•์ธํ•ฉ์‹œ๋‹ค
5 ๊ธ€ ๋ณด์ž„ - 1 ์—์„œ 5 ๊นŒ์ง€ (์ด 5 ์ค‘์—์„œ)
  • ๋‹ต๋ณ€์€ ๋กœ๊ทธ์ธ ํ›„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

About

ํ˜„์žฌ ์›” 700๋ช… ์‹ ๊ทœ์ˆ˜๊ฐ•์ค‘์ž…๋‹ˆ๋‹ค.

  (09:00~20:00) ๋น ๋ฅธ ์ƒ๋‹ด์€ ์นดํ†ก ํ”Œ๋Ÿฌ์Šค์นœ๊ตฌ ์ฝ”๋”ฉ์• ํ”Œ (๋งํฌ)
  admin@codingapple.com
  ์ด์šฉ์•ฝ๊ด€, ๊ฐœ์ธ์ •๋ณด์ฒ˜๋ฆฌ๋ฐฉ์นจ
โ“’ Codingapple, ๊ฐ•์˜ ์˜ˆ์ œ, ์˜์ƒ ๋ณต์ œ ๊ธˆ์ง€
top

ยฉ Codingapple, All rights reserved. ์Šˆํผ๋กœ์ผ“ ์—๋“€์ผ€์ด์…˜ / ์„œ์šธํŠน๋ณ„์‹œ ๊ฐ•๋™๊ตฌ ๊ณ ๋•๋กœ 19๊ธธ 30 / ์‚ฌ์—…์ž๋“ฑ๋ก๋ฒˆํ˜ธ : 212-26-14752 ์˜จ๋ผ์ธ ๊ต์œกํ•™์›์—… / ํ†ต์‹ ํŒ๋งค์—…์‹ ๊ณ ๋ฒˆํ˜ธ : ์ œ 2017-์„œ์šธ๊ฐ•๋™-0002 ํ˜ธ / ๊ฐœ์ธ์ •๋ณด๊ด€๋ฆฌ์ž : ๋ฐ•์ข…ํ