凯发k8天生赢家一触即发

jqueryui dialog函数的基本用法 -凯发k8天生赢家一触即发

2023-10-21

客户端:    

var dialog = $("#classifications").dialog({
        autoopen: false,
        width: 800,
        position: { my: "center", at: "center", of: window },
        buttons: {
            'save': function () {
                var formdata = $("#showclassificationform").serialize();
                $.ajax({
                    type: "post",
                    data: formdata,
                    url: '{{ add_classification_to_maunscript_path(hash_key) }}',
                    success: function(msg) {
                        $(".list-clsfi").html(msg);
                    }
                });
                $("#classifications").dialog('close');
            }
        }
    });
    $("#addclassification").on('click', function(e) {
        e.preventdefault();
        $.get('{{ list_classifications_path(hash_key) }}', function(msg) {
            dialog.dialog('open').html(msg);
        });
    });

服务器端:

   /**
     * list all classifications
     *
     * @param string $hash_key
     */
    public function listclassificationsaction($hash_key)
    {
        $manuscript = $this->getmanuscriptbyhashkey($hash_key);
        if (!$this->currentuser->isownerofmanuscript($manuscript) &&
            !$this->currentuser->canmanagemanuscript($manuscript)) {
                return $this->stopandnopermission();
            }
        $classifications = classificationrepository::getbyhashkey($hash_key);
        return $this->rendersusybundle('user:list_classifications.html.twig', array(
            'classifications' => $classifications,
            'hash_key' => $hash_key
        ));
    }
网站地图