我正在使用jQuery.load()函数动态加载Div中的内容。它适用于所有场景,但其中有一个问题。
当我在 AjaxTag Library 1.5.7 中包含 ajax:select 标记以在我的JSP页面中填充依赖下拉列表时,jQuery.load()函数删除ajax:select来自我加载的JSP页面的标记。
自上次这一天以来,我被困在这个问题上。对问题的早期反应将是很好的。
注意:ajax:select在正常情况下作为HTML加载时会在标记中转换。
代码块:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://ajaxtags.sourceforge.net/tags/ajaxtags"
prefix="ajax"%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
<link type="text/css" rel="stylesheet" href="css/ajaxtags.css"></link>
<title>AJAX JSP Tag Library Examples</title>
<script type="text/javascript" src="ajaxtags/js/prototype-1.7.js"></script>
<script type="text/javascript" src="ajaxtags/js/scriptaculous/scriptaculous.js"></script>
<script type="text/javascript" src="ajaxtags/js/overlibmws/overlibmws.js"></script>
<script type="text/javascript" src="ajaxtags/js/ajaxtags.js"></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
</head>
<body>
<div id="header">AJAX JSP Tag Library Examples</div>
<div id="pageContent">
</div>
</body>
<script type="text/javascript">
function updateContainer( url , formData, divID ) {
var dynamicCon = '#'+divID;
var ObjTag = $( dynamicCon );
ObjTag.load( url , formData );
}
updateContainer("/dropdown.jsp","","pageContent");
</script>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://ajaxtags.sourceforge.net/tags/ajaxtags" prefix="ajax"%>
<form action="." class="basicForm">
<fieldset><legend>Choose Your Car</legend>
<div><img id="makerEmblem" src="img0/placeholder.gif" width="76" height="29" /></div>
<label for="make">Make:</label> <select id="make">
<option value="">Select make</option>
<option value="Ford">Ford</option>
<option value="Honda">Honda</option>
<option value="Mazda">Mazda</option>
</select> <span id="progressMsg" class="indicator" style="display: none;">Loading...</span>
<label for="model">Model:</label> <select id="model" disabled="disabled">
<option value="">Select model</option>
</select></fieldset>
</form>
<ajax:select baseUrl="dropdown.view" source="make" target="model"
parameters="make={make}" preFunction="initProgress"
emptyOptionName="Select model" postFunction=""
errorFunction="" />