使用以下代码在div标签中加载aspx页面。但它没有用。请帮我解决这个问题。
<script type="text/javascript">
$(document).ready(function () {
$('#div_more_pack').load('dss_more_pack.aspx');
});
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title>
<link href="CSS/Styles.css" rel="stylesheet" type="text/css" />
<link href="/WebResource.axd?d=jXYvAvdTPQseQ0chjS0NJiUVoAt1FHDKI8RqT3Bub606dQEw4MJ7tgPzZQtv2Vbv0&t=634959154400107513" type="text/css" rel="stylesheet" />
<style type="text/css">
.uc_more_pack_Cust_tab_tab_service_tree_package_0 { color:Black;font-weight:bold;text-decoration:none; }
</style>
</head>
<body>
<form method="post" action="dss_more_pack.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="uc_more_pack_Cust_tab_ClientState" id="uc_more_pack_Cust_tab_ClientState" value="{"ActiveTabIndex":0,"TabState":[true,true,true,true,true,true,true]}" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="uc_more_pack_Cust_tab_tab_service_tree_package_ExpandState" id="uc_more_pack_Cust_tab_tab_service_tree_package_ExpandState" value="cccnccncccnnnccncncccn" />
<input type="hidden" name="uc_more_pack_Cust_tab_tab_service_tree_package_SelectedNode" id="uc_more_pack_Cust_tab_tab_service_tree_package_SelectedNode" value="" />
<input type="hidden" name="uc_more_pack_Cust_tab_tab_service_tree_package_PopulateLog" id="uc_more_pack_Cust_tab_tab_service_tree_package_PopulateLog" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTM0MjkwNzI5MQ9kFgICAw9kFgICAw9kFgJmD2QWAgIBDw8WBB4HY3VzdF9pZAUCNjgeE3NlbGVjdGVkX2JpbGxfaXRlbXMF6Qc8P3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bnZvaWNlJGJ0bl9wYXltZW50BTB1Y19tb3JlX3BhY2skQ3VzdF90YWIkdGFiX3BheW1lbnQkYnRuX2FjdGl2YXRpb24FM3VjX21vcmVfcGFjayRDdXN0X3RhYiR0YWJfcHJvdmlzaW9uJGNoa19kZXZpY2VfaW5pdAUzdWNfbW9yZV9wYWNrJEN1c3RfdGFiJHRhYl9wcm92aXNpb24kY2hrX2RldmljZV9wYWlyBSx1Y19tb3JlX3BhY2skQ3VzdF90YWIkdGFiX3Byb3Zpc2lvbiRjaGtfc3dhcAUxdWNfbW9yZV9wYWNrJEN1c3RfdGFiJHRhYl9wcm92aXNpb24kY2hrX3Byb3Zpc2lvbgUzdWNfbW9yZV9wYWNrJEN1c3RfdGFiJHRhYl9wcm92aXNpb24kYnRuX3Byb3Zfc3VibWl0BRV1Y19tb3JlX3BhY2skQ3VzdF90YWIPD2RmZAUydWNfbW9yZV9wYWNrJEN1c3RfdGFiJHRhYl9zZXJ2aWNlJGdyZF9wYWNrYWdlX2xpc3QPZ2Rc4h12Whl6san/46joY6ZATbK3UL0hHH/TsWqVnPo6EQ==" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget,eventArgument){
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=NGWHhrhQxVdi6Y5BQUr6nQ2&t=634929307791941336" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=s72EBzlqyW6dq8nmj_nsuG0cSaf4Z0nmMamkiAEH_xLorZXIBJ71Hr3YwVOJXj15DhZSDRzQxMITNszVnYKjJQ2&t=1e961a8d" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function TreeView_PopulateNodeDoCallBack(context,param) {
WebForm_DoCallback(context.data.treeViewID,param,TreeView_ProcessNodeData,context,TreeView_ProcessNodeData,false);
}
var uc_more_pack_Cust_tab_tab_service_tree_package_Data = null;//]]>
</script>
<script src="/ScriptResource.axd?d=3qhHLSWv5cU_c2_8JyEg-cfozgETQm0npL12m8PkbOAhQRNtVs8YWfe_0n0f7Vjn0&t=ffffffffc13acc3f" type="text/javascript"> </script>
//
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
答案 0 :(得分:2)
问题可能是page
的路径。
它应该处于同一水平。
如果他们不在同一水平那么
<script type="text/javascript">
$(document).ready(function () {
$('#div_more_pack').load('dss_more_pack.aspx');
});
</script>
更改为
<script type="text/javascript">
$(document).ready(function () {
$('#div_more_pack').load('../dss_more_pack.aspx');//exact path
});
</script>
您可以编辑您的方法,看看error
$(document).ready(function () {
$('#div_more_pack').load('dss_more_pack.aspx', function(response, status, xhr)
{
if (status == "error") {
var msg = "Sorry but there was an error: ";
alert(msg + xhr.status + " " + xhr.statusText);
}
);
});
$(document).ready(function () {
$('#div_more_pack').load('dss_more_pack.aspx', function(response, status, xhr)
{
alert(response);
}
);
});
答案 1 :(得分:0)
尝试使用AJAX
$.get('dss_more_pack.aspx', {}, function(data) {
$('#div_more_pack').html(data);
});
您也可以使用
$.post('url', parameters, callback)
参考here