Friday, March 15, 2013

Jquery serialize function

<script>


$(document).ready(function () {
    $("#step2").validationEngine();
    $("#Button1").live('click', function () {
        var valid = $("#step2").validationEngine('validate');
        var vars = $("#step2").serialize();

        if (valid == true) {
             wait('Saveing.....');
                $.ajax({
                    type: 'POST',
                    url: SITEURL+'projects/save_edit_step2',
                    data: $("#step2").serialize(),
                    success: function(data){
                        clear();
                        $("#question-answer").html(data);
                    }
                });
            return false;
           
        } else {
            $("#step2").validationEngine();
        }
    });
});
</script>
<script>
$(document).ready( function() {
    $("#step2").validationEngine('');
     $("#step2").submit(function(){
            wait('Saveing.....');
                $.ajax({
                    type: 'POST',
                    url: SITEURL+'projects/save_edit_step2',
                    data: $(this).serialize(),
                    success: function(data){
                        clear();
                        $("#question-answer").html(data);
                    }
                });
            return false;
       });
    } );
   
</script>

No comments:

Post a Comment