【问题标题】:jQuery reload div's content (dynamically rendered)jQuery 重新加载 div 的内容(动态渲染)
【发布时间】:2010-10-30 06:52:51
【问题描述】:

我有一个通过表达式引擎生成 html 的 div。我正在使用 ajax 提交:

$('#login-form').ajaxForm({  
    // success identifies the function to invoke when the server response 
    // has been received; here we apply a fade-in effect to the new content 
    success: function() { 
    $("#panel").RELOAD!!();//Just refresh this div!
    } 
}); 

我只想让#panel div 重新加载/刷新。

【问题讨论】:

    标签: jquery plugins refresh reload


    【解决方案1】:

    我假设您正在寻找类似的东西:

    $('#login-form').ajaxForm({  
        success: function( data) { 
        $("#panel").html( data);//Will insert new content inside div element.
        } 
    });
    

    修复:

    $('#login-form').ajaxForm({ 
        target: '#panel', //Will update the "#panel"
        success: function( data) { 
        alert( "Success");
        } 
    });
    

    【讨论】:

    • 表达引擎在提交后会自动返回。我不知道这是否有效...我认为可以,但 EE 出于某种原因尝试重新加载整个页面...
    【解决方案2】:

    jQuery 的“操作”部分中列出的几乎所有方法都可以满足您的需求:http://docs.jquery.com/Manipulation

    【讨论】:

      【解决方案3】:

      为了你漂亮的淡入淡出

      success : function(data) {
         $("#panel").hide().html(data).fadeIn('fast');
      } 
      

      【讨论】:

      • 这是一个语法问题:为什么你在'fast'周围有单引号而不是双引号?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-23
      • 2017-03-15
      • 2021-05-30
      • 1970-01-01
      • 1970-01-01
      • 2011-06-14
      相关资源
      最近更新 更多