嗨,我正在使用ajax进行国家,州,城市的三重下拉,参考链接是:http://roshanbh.com.np/2008/01/populate-triple-drop-down-list-change-options- value-from-database-using-ajax-and-php.html.它成功地工作但我需要如果一个状态在db表中没有城市然后出现一个新的文本框,输入的值存储在php mysql中.什么编码我实现了.请提出一些想法.
码:
阿贾克斯:
<script language="javascript" type="text/javascript">
function getXMLHTTP() {
var xmlhttp = false;
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
xmlhttp = false;
}
}
}
return xmlhttp;
}
function getState(countryId) {
var strURL = "findState.php?country=" + countryId;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function () {
if …Run Code Online (Sandbox Code Playgroud)