Forms submitted without refreshing the page

There is a demand, 30S page automatically save data, but can not refresh the current page, submit the form data using ajax

data:$(#formId).serialize()

.ajax $ ({
                         // several parameters need to take note 
                        of the type: "POST", // method type 
                        dataType: "json", // expected return of server data type 
                        url: Base + "/ config / saveBrand.action", / / URL 
                        Data: $ ( '# config_add' ) .serialize (), 
                        Success: function (Result) { 
                            IF (Result = "S" ) { 
                                layer.close (loading); 
                                layer.close (index); 
                                var Tip = Tips ( "#-tips1 the Save-Success" );
                                setTimeout(function(){
                                    window.location.reload(); 
                                },1000);
                            }
                            
                        },
                        error : function() {
                            console.log("异常!");
                        }
                    });

 

Guess you like

Origin www.cnblogs.com/zhaoatian/p/11535786.html