prototype.js equivalent to jquery ajaxSettings cache = true addthis plugin
Posted
by
openstepmedia
on Stack Overflow
See other posts from Stack Overflow
or by openstepmedia
Published on 2011-03-04T15:23:12Z
Indexed on
2011/03/04
15:24 UTC
Read the original article
Hit count: 701
I need help from a prototype.js expert:
I'm trying to achieve the following (taken from the addthis forum), and port the solution from jquery to prototype.js (I'm using magento).
Original post is here: http://www.addthis.com/forum/viewtopic.php?f=3&t=22217
For the getScript() function, I can create a custom function to load the remote js, however I'm trying to load the js file via the prototype ajax call, and trying to avoid having the script cached in the browser.
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#changeURL").click(function() {
$(".addthis_button").attr("addthis:url","http://www.example.com");
window.addthis.ost = 0;
window.addthis.ready();
});
});
// prevent jQuery from appending cache busting string to the end of the URL
var cache = jQuery.ajaxSettings.cache;
jQuery.ajaxSettings.cache = true;
jQuery.getScript('http://s7.addthis.com/js/250/addthis_widget.js');
// Restore jQuery caching setting
jQuery.ajaxSettings.cache = cache;
</script>
<p id="changeURL">Change URL</p>
<a class="addthis_button" addthis:url="http://www.google.com"></a>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=rahf"></script>
© Stack Overflow or respective owner