2012-08-24 370 views
0

我不能動態更改內容,我試着.selector.qtip('api').set('content.text',新內容)但它沒有任何東西,我tryied .selector.qtip ('option',content.text',新內容)qtip2動態更改內容

("[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); 
           } 
          }); 
         }); 
        } 
       } 

      }); 

     }); 
    }); 

我選擇了必須改變的地方。

回答

-1

您是否試過僅使用「set」方法而不使用「api」段?

$("[ID*='lnkLogIn']").set('content.text', msg);