2016-05-13 134 views
2

我想恢复变量“idl”在函数远程我有使用window.var,但这是行不通的。 有我的代码。从其他函数恢复变量

function stbStatus(stbInfo){ 
$.post(
     'indexFunctions.php', 
     { 
      stbInfo : stbInfo 
     }, 
        function(data){ 
         $('#screenshot').html(data); 
         $('#refresh').click({param:status},screenshotRefresh); 
         $('form').click(function() { 
         window.idl = this.id; 
         ({param:status},remote); 
         }); 

        } 

       ); 
      } 
     ); 
    }, 
    'json' 
);} 

功能遥控:

function remote(event){ 
    event.preventDefault(); 
    $('html').css('cursor','wait'); 
    var key = $("#"+window.idl).attr('class'); 
     $.get(
      'indexFunctions.php', 
      { 
       keyName: key 
      }, 
      function(){ 
       if (key!="KEY_POWER" && key!="RESET") 
        screenshotRefresh(event);} 

请帮我谢谢你提前。

+0

的可能的复制[怎么办我返回异步调用的响应?](http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) – madalinivascu

+0

'$('#refresh ').click({param:status},screenshotRefresh);'这段代码假设要做什么? – madalinivascu

+0

你好,谢谢你的回答刷新是一个按钮,将调用函数screenshotRefresh.this函数将加载图像形式的服务器,并将其显示为html –

回答

0

成功函数内遥控功能的AJAX的异步性有功能screenshotrefresh的代码

function screenshotRefresh(event){ 
    event.preventDefault(); 
    $('html').css('cursor','wait'); 
    $.post(
     'indexFunctions.php', 
     { 
      screenshot : event.data.param 
      }, 
      function(img){ 
      $('html').css('cursor','default'); 
       $('#screenshot').html(img); 
      } 
     ); 
    }