首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >qtip2动态更改内容

qtip2动态更改内容
EN

Stack Overflow用户
提问于 2012-08-24 21:15:23
回答 1查看 1.3K关注 0票数 0

我不能动态更改内容,我尝试了.selector.qtip('api').set('content.text',新内容),但它什么也不起作用,我尝试了.selector.qtip('option',content.text',新内容)

代码语言:javascript
复制
("[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);
                                }
                            });
                        });
                    }
                }

            });

        });
    });

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

EN

回答 1

Stack Overflow用户

发布于 2012-12-01 02:38:01

您是否尝试过只使用"set“方法而不使用"api”段?

代码语言:javascript
复制
 $("[ID*='lnkLogIn']").set('content.text', msg);
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12110138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档