0

我无法动态更改内容,我尝试了 .selector.qtip('api').set('content.text', new content) 但它什么也没做,我尝试了 .selector.qtip('option', content. text',新内容)

("[ID*='lnkLogIn']").live("click", function (event) {
            $(this).qtip("destroy");
            $(this).qtip({
                id: 'modal', 
                content: {

                    text: "Loading...",
                    ajax: "/DesignerUtils/Component/Other/Login.aspx",
                    title: {
                        button: true
                    }
                },
                position: {
                    my: 'center', // ...at the center of the viewport
                    at: 'center',
                    target: $(window)
                },
                show: {
                    event: false,
                    ready: true,
                    solo: true, // ...and hide all other tooltips...
                    modal: true // ...and make it modal
                },
                hide: false,
                style: 'ui-tooltip-light ui-tooltip-rounded modal1',
                events: {

                    render: function (event, api) {
                        api.set('content.text', event);
                        $(this).qtip('api').set('content.text', 'new content');
                        function errorHandler(jqXHR, message) {
                            // Set the error and show/hide it
                            $('.error', api.elements.tooltip).html(message || '').toggle(!!message);

                        }
                        $(this).find('#register').live('click', function () {
                            $.ajax({
                                type: "POST",
                                url: "../log.asmx/GetRegisterForm",
                                data: "{}",
                                contentType: "application/json; charset=utf-8",
                                dataType: "json",
                                success: function (msg) {
                                    $("[ID*='lnkLogIn']").qtip('api').set('content.text', msg); // <---- HERE I WANT DINAMICALY CHANGE CONTENT
                                },
                                error: function (xhr, status, error) {
                                    // Show the error

                                    alert(xhr.responseText);
                                }
                            });

                        });

                        $(this).find('#Login').live('click', function (event) {

                            var username = $(this).parent().find('.username').val();
                            var password = $(this).parent().find('.password').val();
                            $.ajax({
                                type: "POST",
                                url: "../log.asmx/GetRSSReader",
                                data: "{username: '" + username + "', password: '" + password + "'}",
                                contentType: "application/json; charset=utf-8",
                                dataType: "json",
                                success: function (msg) {
                                    if (msg) {
                                        setTimeout(function () { window.location.reload() }, 200);
                                    }
                                },
                                error: function (xhr, status, error) {
                                    // Show the error

                                    alert(xhr.responseText);
                                }
                            });
                        });
                    }
                }

            });

        });
    });

我选择了它必须改变的地方。

4

1 回答 1

-1

您是否尝试过仅使用没有“api”段的“set”方法?

 $("[ID*='lnkLogIn']").set('content.text', msg);
于 2012-11-30T18:38:00.943 回答