。
$(document).ready(function(){
$("#pop1").click(function(){
$("#shadow").fadeIn("normal");
$("#form1").fadeIn("normal");
$("#firstname").focus();
});
$("#cancel_hide").click(function(){
$("#form1").fadeOut("normal");
$("#shadow").fadeOut();
});
$("#insert").click(function(){
fname =$("#firstname").val();
lname =$("#lastname").val();
addr =$("#adres").val();
city =$("#city").val();
state =$("#state").val();
zip =$("#zip").val();
tel =$("#phone").val();
email =$("#email").val();
ip =$("#ip").val();
source =$("#source").val();
date =$("#date").val();
$.ajax({
type : "POST",
url : "save.php",
data : "fname="+fname+"&lname="+lname+"&addr="+addr+"&city="+city+"&state="+state+"&zip="+zip+"&tel="+tel+"&email="+email+"&ip="+ip+"&source="+source+"&date="+date,
success : function(html){
if(html=='true')
{
$("#form1").fadeOut("normal");
$("#shadow").fadeOut();
$("#profile").html("<a href='logout.php' id='logout'>Logout</a>");
}else{
$("#add_err").html("Wrong username or password");
}
},
beforeSend:function(){
$("#add_err").html("Loading...")
}
});
return false;
});
});
我的索引.php文件是 obove
如何将保存.php中发生的错误打印到索引中.php
对于考试,我如何将此输出普入索引中的div .php呼应"畑之:".mysql_errno(("。
Hata Mesajý :".mysql_error((;
由于 PHP 返回 HTML,你可以像这样写出来,假设你有一个div 的 id="result" -
if(html=='true') {
$('#result').text(html);
// rest of your code here
当然,您可能希望检查HTML中返回的内容,以便知道是否要显示此信息。