1

I'm trying to display an Alert message through ajaxSubmit as successful as in the example code below:

submitHandler: function( form ){ 
                var dados = $( form ).serialize(); 
                $.ajaxSubmit({  
                    type: "POST",   
                    url: "...",  
                    data: dados,  
                    complete: function( data )  
                    {  
                       // $("#cargo").resetForm();
                        alert("Alert Message"); 
                        $("#txtNome").focus();
                            $("#txtNome")
                            .hide()
                            .show("slow");
                            document.getElementById("cargo").reset();

                    } 
                }); 
                return false;  
            }

But every time the form data is saved, but no Alert message is shown! Can anyone help me?

4

1 回答 1

0

检查此代码。这是工作。

jQuery('#formId').validate({
    submitHandler: function(form) {
          jQuery("#formId").ajaxSubmit({
            success: function(data)     {
                             alert("hello");
                            jQuery('#element').html(data);
                        },
            data: {ajax:'true', tab:'true'}
        }); 
    }
});

以这种格式放置您的代码。

于 2012-06-04T18:29:57.243 回答