2016-07-21 10 views
0

迅速たとえばリフレッシュ。フォースキャッシュは、一つの容器

#exampleに強制的にキャッシュを更新する方法はありますか?以下のような

何か:あなたはURLのを要求した場合

<scipt> 
// Here I execute a php script that changes the image 'example.png' 
$('#example').hide().load('content/content.php #example').show(); 
// Refresh Cache for #example or execute php(refresh) 
</script> 

おかげ

答えて

0

は、ブラウザがそのは別のページを要求すると思う作り、それにGETパラメータを追加することができます。これにより、ブラウザは常に最新バージョンをダウンロードします。

以下を試すことができます。私はJQuery自身はあまり良くはありませんが、これはうまくいくと思います。

$.get("content/content.php",{},function(e) { 
    // now we update the image since the content.php has finished loading. 
    $('#example').attr("src","example.png?e="+(new Date().getTime())); 
}); 
関連する問題