Javascript 使用jqueryajax加载代替iFrame
我试图将jquery加载函数与ajax结合使用,作为使用iFrame的替代方法 我的代码是:Javascript 使用jqueryajax加载代替iFrame,javascript,jquery,ajax,iframe,Javascript,Jquery,Ajax,Iframe,我试图将jquery加载函数与ajax结合使用,作为使用iFrame的替代方法 我的代码是: <asp:UpdatePanel ID="upQnA" runat="server"> <ContentTemplate> <div id="dQnA" style="position:relative" title="QnA" >
<asp:UpdatePanel ID="upQnA" runat="server">
<ContentTemplate>
<div id="dQnA" style="position:relative" title="QnA" >
QnA</div>
<script type="text/javascript">
$(function () {
$("#dQnA").load("http://www.google.com", function (responseText, statusText, xhr) {
if (statusText == "success")
alert("Successfully loaded the content!");
if (statusText == "error")
alert("An error occurred: " + xhr.status + " - " + xhr.statusText);
});
});
</script>
</ContentTemplate>
<Triggers><asp:AsyncPostBackTrigger ControlID="tmLanding" EventName="Tick"/></Triggers>
</asp:UpdatePanel>
QnA
$(函数(){
$(“#dQnA”)。加载(“http://www.google.com,函数(响应文本、状态文本、xhr){
如果(状态文本==“成功”)
警报(“已成功加载内容!”);
如果(状态文本==“错误”)
警报(“出现错误:“+xhr.status+”-“+xhr.statusText”);
});
});
但是当我点击谷歌页面的搜索按钮时,页面会被刷新,而不是显示结果
QnA
。我想知道如何使用jquery加载函数将加载页面的代码隐藏在div中。这不是jquery代码,这是microsoft的ajax更新面板…请检查ajax jquery reuest ongoogle@PranayRana我不是说这是jquery代码。我是说我在.net代码中是jquery加载函数。我无法使用正在加载到asp面板的任何页面的功能,无论是google页面还是本地aspx页面。这两个库之间可能存在冲突