如何使用javascript或jquery在html div标签中加载url [英] How to load the url in html div tag using javascript or jquery
本文介绍了如何使用javascript或jquery在html div标签中加载url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面我通过'url'加载了div标签内的网页。但它不起作用。有谁知道请帮助。
Here the below i have wriiten for load the webpage inside of div tag via 'url' i've enclosed. but it not working. can anyone know. pls help.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<a href="#" önClick="lurl();">Click Here</a>
<br/>
<br/>
<br/><div id="durl">
</div>
<script type="text/javascript">
function lurl(){
$('#durl').load('http://www.tndte.com/Result/');
}
</script>
</html>
推荐答案
(' #durl')。load(' < span class =code-string> http://www.tndte.com/Result/');
}
< / 脚本 >
< / html >
('#durl').load('http://www.tndte.com/Result/'); } </script> </html>
您好,
由于浏览器安全限制,大多数Ajax请求都遵循相同的原始策略;请求无法从其他域,子域或协议成功检索数据。
问候,
Hello,
Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol.
Regards,
这对我有用
It is working for me
<div id="topBar"> <a href ="#" onclick="load_home()"> HOME </a> </div>
<div id ="content"> </div>
<script>
function load_home(){
document.getElementById("content").innerHTML='<object type="type/html" data="home.html" ></object>';
}
</script>
这篇关于如何使用javascript或jquery在html div标签中加载url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文