我对某个外部站点进行POST,该站点吐出一个URL,我使用bit.ly截断该URL。我想获取那个URL并将它用于AddThis中的自定义URL字段。
我该怎么做呢?
看一下获取url的jQuery ajax方法
我会在AJAX调用返回URL后用javascript呈现按钮
http://support.addthis.com/customer/portal/articles/381263-addthis-client-api rendering-js
这段代码应该可以让你开始:
addthis.button(document.getElementById('my-button'), { }, { url: bitlyUrl });
我尝试了很多以上的解决方案,没有一个适合我,去了这样的东西$('.addthis_toolbar').attr('addthis:url', 'http://google.com');
要让它工作,你需要AddThisdiv看起来像这样
<div class="addthis_toolbox addthis_default_style addthis_32x32_style share-bar" addthis:url="">