我有这个 AJAX 表单:
function form(){
var icao = document.getElementById('icao').value;
var name = document.getElementById('name').value;
var weightempty = document.getElementById('weightempty').value;
var weightfull = document.getElementById('weightfull').value;
var cargofull = document.getElementById('cargofull').value;
var cruisespeed = document.getElementById('cruisespeed').value;
var range = document.getElementById('range').value;
var price = document.getElementById('price').value;
var firstclassseats = document.getElementById('firstclassseats').value;
var businessclassseats = document.getElementById('businessclassseats').value;
var economyclassseats = document.getElementById('economyclassseats').value;
ajax.open("POST","new_aircraft_process.php",true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4)
{
var respuesta=ajax.responseText;
document.getElementById('result').innerHTML=ajax.responseText;
$("#newaircraftdialog").dialog('close');
refreshTable(function(){$("#loadingdialog").dialog('close');});
}
}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send("icao="+icao+"&name="+name+"&weightempty="+weightempty+"&weightfull="+weightfull+"&cargofull="+cargofull+"&cruisespeed="+cruisespeed+"&range="+range+"&price="+price+"&firstclassseats="+firstclassseats+"&businessclassseats="+businessclassseats+"&economyclassseats="+economyclassseats);
$("#loadingdialog").dialog('open');
}
我想要的是在结果 div 中显示结果时(它是一个显示“成功表单”的文本),它是否仅可见 5 秒然后消失。我找到了各种方法,但不想删除 div。因为如果我想再次制作表单,结果将不得不再次显示在 div 中,并在 5 秒后消失。