관리 메뉴

moozi

vueAjax04.html 본문

TIS_2019/응용sw2019_2기

vueAjax04.html

moozi 2019.11.06 15:13

<!DOCTYPE html>

<html lang="ko">

  <head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>webpos-do</title>

    <script src="https://unpkg.com/vue"></script>

    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>

   

    <script>

        $(document).ready(function(){   

 

            console.log("zzzzzzzzzzzz");    

 

                var app= new Vue({

                    el: '#app',

                    data: {

                        id:"",

                        name:"",

                        address:""

                        

                    },

                    methods:{

                        getMember:function(){

                            $.ajax({

                            url:"http://pjs.dothome.co.kr/ajaxDB3.php?id=hkd",

                            dataType:"json",

                            success:function(data){

                                

                                console.log(data);

                            

                                app.id=data.id;

                                app.name=data.name;

                                app.address=data.address;

                

                                }

                            });

                        },

                        updateMember:function(){

                            console.log("==================");    

                            var frmData=$("#frm1").serialize();//폼에 입력한 값 데이터화

 

                            

                            $.ajax({

                                type:"POST",

                                url:"http://pjs.dothome.co.kr/memberUpdate.php",

                                data:frmData,

                                success:function(res){                                            

                                    if(res){                           

                                        console.log(res.message);  

                                        $("#message").html(res.message);                        

                                    }                                

                                }

                            });

                        }    

 

                    }

                        



                });

            

            app.getMember();

 

            // $("#modify").on("click",function(){

                

            //     console.log("==================");    

            //     var frmData=$("#frm1").serialize();//폼에 입력한 값 데이터화

 

                

            //     $.ajax({

            //         type:"POST",

            //         url:"http://pjs.dothome.co.kr/memberUpdate.php",

            //         data:frmData,

            //         success:function(res){                                            

            //             if(res){                           

            //                 console.log(res.message);  

            //                 $("#message").html(res.message);                        

            //             }                                

            //         }

            //     });

            // });    





        });

    </script>

 

  </head>

  <body>

   <div id='app'>

        <form id="frm1">

                <input type="text" name="id" v-model="id" readonly><br>

                name <input type="text" name="name" v-model="name"><br>

                address <input type="text" name="address" v-model="address"><br>

                <input id="modify" type="button" v-on:click="updateMember" value="회원정보수정">

        </form>

        <div id="message"></div>

    </div>

   

    

  </body>

</html>

 

'TIS_2019 > 응용sw2019_2기' 카테고리의 다른 글

memberUpdate.php  (0) 2019.11.07
포트폴리오 url  (21) 2019.11.06
vueAjax04.html  (0) 2019.11.06
ajaxDB3.php  (0) 2019.11.06
vue.js ajax with axios  (0) 2019.11.06
AjaxDB2.php  (0) 2019.11.06
0 Comments
댓글쓰기 폼