IFrame错误:无法加载资源:服务器以状态404(未找到)响应

时间:2020-04-18 13:20:01

标签: javascript php ajax iframe file-not-found

尝试加载文件夹中存在的iframe源时,出现了这样的错误。我尝试了一切,因为我是php新手,我的知识有限

我的Php变量传递给javascript变量

我的php变量: $ value_of_schedule =“ Sat_20_30”;

我的JavaScript代码:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
  $('#button').click(function(){ 
    if(!$('#iframe').length) {
      var ValueOfSchedule_1 ="<?php echo json_encode($value_of_schedule); ?>";
       $('#iframeHolder').html('<iframe src ="../filemanager/logs/'+ValueOfSchedule_1+'/report.html"  height="1100px" width="100%">');
    }  
  });   
});
</script>

在这里,如果我提供console.log,它将在日志文件中检索schedulename,但是在src框架中它将写为null,表示无法访问。如果我运行并检查iframe部件,它将显示以下内容:

<iframe src="../filemanager/logs/null/report.html" height="1100px" width="100%"></iframe>

0 个答案:

没有答案