IE中的jQuery缓存

Nie*_*che 7 jquery internet-explorer wufoo jquery-templates

我们在这里有一个使用Wufoo表单和Wufoo jQuery API的站点.

我们从API中提取数据,对其进行排序,然后在页面上显示.当我们提交的数字高于当前前10名时,它应该在右侧实时更新,因为表单会重定向回自身.它这样做,但不是在IE中.相反,在提交表单和显示新数据之间似乎存在不必要的延迟.关闭浏览器并重新打开页面似乎有效,但这没有用.

这是我们正在使用的jQuery:

<script>
    $.wufooAPI.getEntries({
        "callback"   : processEntries,             
        "formHash"   : "x7x1x7",                   
        "sortID"   : "Field3",                   
        "sortDirection"   : "DESC",
    });
    function processEntries(data) {
        $.each(data.Entries.slice(0, 10), function(entriesIndex, entriesObject) {
            // Make sure this entry has all the required bits
            if (entriesObject.Field1 && entriesObject.Field3) {
                $("#attendeeTemplate").tmpl(entriesObject).appendTo("#people ul");  
            }
        });
    };

</script>
Run Code Online (Sandbox Code Playgroud)

这是模板代码:

            <script id="attendeeTemplate" type="text/x-jquery-tmpl">
                <li>
                    <h4>${Field1}</h4>
                    ${Field3} minutes
                </li>
            </script>
Run Code Online (Sandbox Code Playgroud)

它在除IE8和9之外的所有浏览器中都能很好地工作,当它看起来像是在缓存数据而不是从服务器提取请求时.

有没有办法停止在IE中缓存jQuery?

web*_*bod 20

一个简单的方法是用时间戳欺骗和加盐您的请求URL(但这有点笨拙).您可以关闭ajax请求的缓存:

$.ajaxSetup ({
    // Disable caching of AJAX responses
    cache: false
});
Run Code Online (Sandbox Code Playgroud)

MSDN在IE http://support.microsoft.com/kb/234067中有一个关于缓存避免的页面.