Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/446.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 内联tumblr';邮政';防止外部jQuery触发的脚本_Javascript_Jquery_Tumblr_Imageurl - Fatal编程技术网

Javascript 内联tumblr';邮政';防止外部jQuery触发的脚本

Javascript 内联tumblr';邮政';防止外部jQuery触发的脚本,javascript,jquery,tumblr,imageurl,Javascript,Jquery,Tumblr,Imageurl,我在他们的文档后面实现了一个tumblr post按钮,弹出窗口效果很好。但是,我需要传入在页面上动态创建的图像URL,而不是在图像URL中进行硬编码。我正试图用jQuery实现这一点 但是,启动“post”弹出窗口所需的内联脚本会触发,并阻止我的jQuery(通过单击“post”按钮触发)触发。我尝试将内联tumblr脚本移动到我的js中,这允许我的jQuery启动,但不允许tumblr弹出窗口 理想情况下,内联脚本将在jQuery之后启动,因为jQuery是生成我需要传入的图像URL的位 有

我在他们的文档后面实现了一个tumblr post按钮,弹出窗口效果很好。但是,我需要传入在页面上动态创建的图像URL,而不是在图像URL中进行硬编码。我正试图用jQuery实现这一点

但是,启动“post”弹出窗口所需的内联脚本会触发,并阻止我的jQuery(通过单击“post”按钮触发)触发。我尝试将内联tumblr脚本移动到我的js中,这允许我的jQuery启动,但不允许tumblr弹出窗口

理想情况下,内联脚本将在jQuery之后启动,因为jQuery是生成我需要传入的图像URL的位

有没有办法做到这一点,也许是用onLoad或者别的什么

Tumblr生成的我的按钮是这样的(很抱歉,由于某些原因,我无法在多行上获取它):

任何帮助都将不胜感激

 <a class='tumblr-share-button' data-color='blue' data-notes='right' data-posttype='photo' data-content='image URL will go here' href='https://embed.tumblr.com/share'></a> <script>!function(d,s,id){var js,ajs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://assets.tumblr.com/share-button.js';ajs.parentNode.insertBefore(js,ajs);}}(document, 'script', 'tumblr-js');</script>
$('.tumblr-share-button').click(function(e){
var svg = $("#svg")[0];
svg.toDataURL("image/png", {
    callback: function(img) {
    var img = img.replace("data:image/png;base64,", "");
    var imgurTitle = $("meta[property='og:title']").attr("content");
    $.ajax({ 
          url: 'https://api.imgur.com/3/image',
          headers: {'Authorization': 'Client-ID ******'},
          type: 'POST',
          data: {'image': img, 'type': 'base64', 'title': imgurTitle},
          success: function(result) { 
          imageURL = result.data.link;
          $('.tumblr-share-button').data('data-content',imageURL);
          },
          error: function(){
            console.log('error');
          }
    });
  }
  });
 });