绑定字符串响应(用HTML标签)来的iframe [英] Binding string response(with HTMLTags) to iframe
本文介绍了绑定字符串响应(用HTML标签)来的iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做一个AJAX调用休息终点返回HTML标签作为字符串响应。现在,我需要绑定这iframe中。
I make a ajax call to rest endpoint which returns HTML tags as a string response. Now I need to bind this to iframe.
下面的内容中的HTML标签,如
Here data has html tags like
var data="<html><head><title>iFram</title></head><body>hi</body></html>"
我已经试过的document.getElementById('iframeid')。SRC =数据
我也试过
$('#iframeid').contents().find("html").append(data);
感谢
推荐答案
最后,我们已经得到了使用iframe属性srcdoc的解决方案
我们使用像的document.getElementById('iframeid')srcdoc =数据;
finally we have got the solution with iframe attribute "srcdoc" which
we used like document.getElementById('iframeid').srcdoc=data;
这篇关于绑定字符串响应(用HTML标签)来的iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文