public function getPluginOptions()
    {
        if ($this->url !== null) {
            $url = Url::to($this->url);
            $this->pluginOptions['load'] = new JsExpression("
                function (query, callback) {
                    if (!query.length) return callback();
                    $.getJSON('$url', { query: encodeURIComponent(query) }, function (data) { callback(data); })
                    .fail(function () { callback(); });
                }
            ");
        }

        return Json::encode($this->pluginOptions);
    }