<?php echo "1"; ?>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> </head> <body> <div>www.1sucai.cn</div> </body> </html> <script type="text/javascript"> //js代码放到这里 </script>
<script type="text/javascript">
function test(value){ //定义一个function
error = false; //定义一个测试变量
$.ajax({ //ajax异步请求
type: "POST", //传值方式post
url: "test.php", //异步请求的文件
data: "name="+value, //异步请求的参数
success: function(msg){ //请求成功的回调函数
if($.trim(msg) == '1'){
error = true; //返回值为1,把error变成true
}
}
});
alert(error); //打印一下error的内容,在这里你知道它会弹出什么吗?
if(error == true){
$("div").remove();
}
}
test("good");
</script>
<script type="text/javascript">
function test(value){
error = false;
$.ajax({
type: "POST",
url: "test.php",
data: "name="+value,
success: function(msg){
if($.trim(msg) == '1'){
error = true;
alert(error); //在这里打印一下error
}
}
});
alert(error); //在这里打印一下error
if(error == true){
$("div").remove();
}
}
test("good");
</script>
<script type="text/javascript">
function test(value){
$.ajax({
type: "POST",
url: "test.php",
data: "name="+value,
success: function(msg){
$("div").remove(); //实际要操作的动作
}
});
}
test("good");
</script>
<script type="text/javascript">
function test(value){
error = false;
$.ajax({
type: "POST",
url: "test.php",
async: false, //进行同步请求,默认是true的
data: "name="+value,
success: function(msg){
if($.trim(msg) == '1'){
error = true;
alert(error); //弹一下error
}
}
});
alert(error); //在弹一下error
if(error == true){
$("div").remove();
}
}
test("good");
</script>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有