在AJAX中嵌入代码错误

embed code in AJAX error

本文关键字:代码 错误 AJAX      更新时间:2023-09-26

我想用AJAX来调用嵌入代码因为我有很多通道我不想用PHP echo

我使用这个代码

embedios="<video x-webkit-airplay='"allow'"> ";
embedios=embedios+"<source src='""+stream+"'" type='"video/mp4'"> ";
embedios=embedios+"<!-- other sources and fallbacks go here --></video> ";
embed=embedios;

问题是输出是这样的

<video x-webkit-airplay="allow" tabindex="0">
<source type="video/mp4" src="http://yoursn0w.com/ch3.m3u8 "></source>
<!-- other sources and fallbacks go here -->
</video>

但是我想让它像这样显示

<video x-webkit-airplay="allow"> 
  <source src="http://yoursn0w.com/ch3.m3u8" type="video/mp4"> 
  <!-- other sources and fallbacks go here --> 
</video>

我不知道我在这段代码中做错了什么

你没有终止你的字符串:

embedios="<video x-webkit-airplay='"allow'">"
embedios=embedios+"<source src='""+stream+"'" type='"video/mp4'">"
embedios=embedios+"<!-- other sources and fallbacks go here --></video>"
embed=embedios;

你的引号不匹配。

var embedios='<video x-webkit-airplay='"allow'">'
embedios=embedios+'<source src='""+stream+"'" type='"video/mp4'">'
embedios=embedios+'<!-- other sources and fallbacks go here --></video>'
embed=embedios;