1
jQuery.validator.addMethod("uniquerheading", function(value, element) {     
        var data = false;
        $action_name = 'checkunquieannoucementheading';

        var url = '<?php echo "$module_name/$controller_name/checkunquieannoucementheading"; ?>';
        $.ajax({
             url: url,
             type: 'get',
             data: {
                "txt_heading":value             
             },
             success: function(data) {              
                // Display list on the page by replacing the content on existing, get from the controller-action
                return data;
             }
        });


}, "Annoucement heading already used");
4

1 に答える 1

0

作業コード...非同期を使用するだけです:false

jQuery.validator.addMethod("uniquerheading", function(value, element) { 

        $action_name = 'checkunquieannoucementheading';
        var response = false;
        var url = '<?php echo "$module_name/$controller_name/checkunquieannoucementheading"; ?>';
            $.ajax({
            url: url,
            type: 'get',
            data: {
                    "txt_heading":value             
            },
            success: function(data) {               
                // Display list on the page by replacing the content on existing, get from the controller-action
                response =  data;
            },
            async:   false
        })

        return response;

}, "Annoucement heading already used");
于 2013-02-19T05:23:26.110 に答える