Wednesday, December 10, 2014

Using post to submit a form

Using post to submit a form

[
Example of submitting a form on click of a button.
Form name is regForm.
]

on(dom.byId('button0'),'click',function(){
                                     request.post("http://localhost/yii/g3labs/?r=Group/register",{data:domForm.toObject('regForm')}).then(

                                                function(data){

                                                alert(data);

                                    query("#resultDiv").html(data).style({color:'green',fontWeight:'bold',fontSize:'20px',border:'10 dashed red'});

                                                },

                                                function(err){

                                    //          alert('err');

                                                            query("#resultDiv").text(err.message).style({color:'red',fontWeight:'bold',fontSize:'26px'});          

                                                }

                                    );
                       //          registry.byId("dialog0").hide();
                        ownerformrefresh();  
                         ownerpsyrefresh();

                        });

 

No comments:

Post a Comment