I use ajax to post. And After the post, I append them to the current page successfully.
var content= $('#content').val();
$.ajax({
type: "POST",datatype:"json", async: false, cache: true,
contentType: "application/x-www-form-urlencoded",
url: "/share.php",
data: "content=" + content,
success: function(html){
$(body).append();
}
});
However, on share.php, there are these lines
<script src="jquery.js"></script>
<script type="text/javascript" src="fancybox/source/jquery.fancybox.js?v=2.0.6"></script>
These are needed to make js gallery work on dynamically added contents added from share.php to the current page. It works successfully.
But the problem is, browsers always cache again for js files.
I can add all the script into that page using
<script>
// all js content
</script>
But that would be an unprofessional approach and it could take too much bandwith.
What is the correct way to make browsers cache the scripts ?