MorganJH-Kim / RamenRecipeBook

0 stars 0 forks source link

글쓰기 기능 #5

Open MorganJH-Kim opened 3 years ago

MorganJH-Kim commented 3 years ago
MorganJH-Kim commented 3 years ago

ajax 사용에서 많은 에러와 직면했으나 해결하여 글쓰기 기능을 완성 할 수 있었음.

                                $.ajax({
                    enctype: 'multipart/form-data', 
                    type:"post",
                    url:"/post/create",
                    processData: false, 
                    contentType: false,  
                    data:formData,
                    success:function(data) {
                        if(data.result == "success") {
                            location.href = "/post/main";
                        } else {
                            alert("레시피 등록에 실패했습니다.");
                        }
                    }, error:function(e) {
                        alert("ajax error");
                    }
                });