1. 程式人生 > >layer彈窗與ajaxSubmit的使用

layer彈窗與ajaxSubmit的使用

  1. <script type="text/javascript">
    $(function(){
    $("#loginBtn").click(function() {
        $("#register-form").ajaxSubmit({
                clearForm: false,
                dataType: "JSON",
                success: function(responseText, statusText) {
                    if (statusText == "success") {
                        if (responseText.result == 1) {
                            parent.window.location.href=responseText.retUrl
                            var index = parent.layer.getFrameIndex(window.name); //先得到當前iframe層的索引
    parent.layer.close(index)
                        } 
                 }
                
                },
                error: function() 
                }
            });


        });
    })
    </script>