Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.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/8/mysql/68.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/powershell/11.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 行刑前拖延_Javascript - Fatal编程技术网

Javascript 行刑前拖延

Javascript 行刑前拖延,javascript,Javascript,我这里有一个JavaScript: $('#takePicturebtn').click(function() { var injectImage = function(id, url) { var z = document.getElementById(id); z.src=url; }; injectImage("pic", $.getJSON('/picture')); }); $.getJSON('/picture')需

我这里有一个JavaScript:

$('#takePicturebtn').click(function()
  {
    var injectImage = function(id, url) {
      var z = document.getElementById(id);
      z.src=url;  
      }; 
    injectImage("pic", $.getJSON('/picture'));
  });
$.getJSON('/picture')
需要一些时间来执行并返回图像链接。是否有可能给一些时间/延迟来执行,然后继续该过程

烧瓶功能:

@app.route("/picture")
    def picture():
        link = interact().ftpSession('/home/pi/AlarmwebNew/pictures/' + interact().grabPicture(), interact().grabPicture())
        return  jsonify(pictureLink=link)
jQuery.getJSON( url [, data ] [, success ] )
如中所述,有一些回调函数:

@app.route("/picture")
    def picture():
        link = interact().ftpSession('/home/pi/AlarmwebNew/pictures/' + interact().grabPicture(), interact().grabPicture())
        return  jsonify(pictureLink=link)
jQuery.getJSON( url [, data ] [, success ] )
所以,只要做:

$.getJSON('/picture', function(){
    alert('done reading json');
});
如中所述,有一些回调函数:

@app.route("/picture")
    def picture():
        link = interact().ftpSession('/home/pi/AlarmwebNew/pictures/' + interact().grabPicture(), interact().grabPicture())
        return  jsonify(pictureLink=link)
jQuery.getJSON( url [, data ] [, success ] )
所以,只要做:

$.getJSON('/picture', function(){
    alert('done reading json');
});
如中所述,有一些回调函数:

@app.route("/picture")
    def picture():
        link = interact().ftpSession('/home/pi/AlarmwebNew/pictures/' + interact().grabPicture(), interact().grabPicture())
        return  jsonify(pictureLink=link)
jQuery.getJSON( url [, data ] [, success ] )
所以,只要做:

$.getJSON('/picture', function(){
    alert('done reading json');
});
如中所述,有一些回调函数:

@app.route("/picture")
    def picture():
        link = interact().ftpSession('/home/pi/AlarmwebNew/pictures/' + interact().grabPicture(), interact().grabPicture())
        return  jsonify(pictureLink=link)
jQuery.getJSON( url [, data ] [, success ] )
所以,只要做:

$.getJSON('/picture', function(){
    alert('done reading json');
});

您必须使用回调。试试这个:

$('#takePicturebtn').click(function()
{
    $.getJSON('/picture', function(data) 
    {            
        var z = document.getElementById('pic');
        z.src=data.pictureLink;  
    }); 
});

您必须使用回调。试试这个:

$('#takePicturebtn').click(function()
{
    $.getJSON('/picture', function(data) 
    {            
        var z = document.getElementById('pic');
        z.src=data.pictureLink;  
    }); 
});

您必须使用回调。试试这个:

$('#takePicturebtn').click(function()
{
    $.getJSON('/picture', function(data) 
    {            
        var z = document.getElementById('pic');
        z.src=data.pictureLink;  
    }); 
});

您必须使用回调。试试这个:

$('#takePicturebtn').click(function()
{
    $.getJSON('/picture', function(data) 
    {            
        var z = document.getElementById('pic');
        z.src=data.pictureLink;  
    }); 
});

一种方便的方法是重新设计
injectImage
函数,接受(Promise)对象作为第二个参数,而不是字符串

var injectImage = function( id, promise ) {
    $.when( promise ).done(function( url ) { 
        var z = document.getElementById(id);
        z.src=url;  
    });    
}; 

一种方便的方法是重新设计
injectImage
函数,接受(Promise)对象作为第二个参数,而不是字符串

var injectImage = function( id, promise ) {
    $.when( promise ).done(function( url ) { 
        var z = document.getElementById(id);
        z.src=url;  
    });    
}; 

一种方便的方法是重新设计
injectImage
函数,接受(Promise)对象作为第二个参数,而不是字符串

var injectImage = function( id, promise ) {
    $.when( promise ).done(function( url ) { 
        var z = document.getElementById(id);
        z.src=url;  
    });    
}; 

一种方便的方法是重新设计
injectImage
函数,接受(Promise)对象作为第二个参数,而不是字符串

var injectImage = function( id, promise ) {
    $.when( promise ).done(function( url ) { 
        var z = document.getElementById(id);
        z.src=url;  
    });    
}; 


可能重复的(以及大约1000个其他)使用setTimeout延迟进程。@Bharath-不要鼓励
setTimeout
处理异步编程-因为它可能会意外地解决用户的问题problem@Adam是的,我只是想延迟ajax请求,但最终OP希望ajax本身延迟(以及大约1000个其他人)使用setTimeout延迟进程。@Bharath-不要鼓励
setTimeout
处理异步编程-因为它可能会意外地解决用户的问题problem@Adam是的,我只是想延迟ajax请求,但最终OP希望ajax本身延迟。可能的重复(以及大约1000个其他)使用setTimeout延迟进程。@Bharath-不要鼓励
setTimeout
处理异步编程-因为它可能会意外地解决用户的问题problem@Adam是的,我只是想延迟ajax请求,但最终OP希望ajax本身延迟。可能的重复(以及大约1000个其他)使用setTimeout延迟进程。@Bharath-不要鼓励
setTimeout
处理异步编程-因为它可能会意外地解决用户的问题problem@Adam是的,我只是想延迟ajax请求,但最终OP希望ajax本身延迟(“/图片”)返回一个图片链接,如,我想在img标签中使用该链接:你能给我更多关于你的实现的信息吗?谢谢,真的很抱歉noobness@user3207652很抱歉,是我不理解您的代码。我已经更新了它。
src
参数将包含一个带有ima源的字符串ge,对吗?所以只需将其设置为id为pic的image元素的
src
属性。id可能会改变吗?谢谢你的回答。src必须获得getJSON的值(这是一个图片链接)。脚本的概念是执行JSON函数,然后将值(link)传递给id=“pic”的img标记.F.E我不知道你是否完全了解我需要做的事情。不是母语英语,但我已经尽力了。返回链接的flask函数已添加到原始问题中。我想你会觉得它对正确的建议很有用。我尝试通过将图像标记上的src设置为等于animated.gif.Th来显示动画加载图片e第一次显示加载图片,然后拍摄的图片显示出来。现在一切都很好。但是关闭模式并再次按下按钮,模式会显示上一张图片。因此,显示另一张图片没有帮助。我也会尝试你的其他建议。我感谢你的帮助。非常感谢!我有点失望在这里输入json、json.id和json.url返回一个图片链接,如,我想在img标签中使用该链接:你能给我更多关于你的实现的信息吗?谢谢,真的很抱歉noobness@user3207652很抱歉,是我不理解您的代码。我已经更新了它。
src
参数将包含一个带有ima源的字符串ge,对吗?所以只需将其设置为id为pic的image元素的
src
属性。id可能会改变吗?谢谢你的回答。src必须获得getJSON的值(这是一个图片链接)。脚本的概念是执行JSON函数,然后将值(link)传递给id=“pic”的img标记.F.E我不知道你是否完全了解我需要做的事情。不是母语英语,但我已经尽力了。返回链接的flask函数已添加到原始问题中。我想你会觉得它对正确的建议很有用。我尝试通过将图像标记上的src设置为等于animated.gif.Th来显示动画加载图片e第一次显示加载图片,然后拍摄的图片显示出来。现在一切都很好。但是关闭模式并再次按下按钮,模式会显示上一张图片。因此,显示另一张图片没有帮助。我也会尝试你的其他建议。我感谢你的帮助。非常感谢!我有点失望在这里输入json、json.id和json.url返回一个图片链接,如,我想在img标签中使用该链接:你能给我更多关于你的实现的信息吗?谢谢,真的很抱歉noobness@user3207652很抱歉,是我不理解您的代码。我已对其进行了更新。
src
参数将包含一个带I源的字符串