---简单示意---
<script type = "text/javascript ">
var xmlHttp
function doStart(value)
{
var namevalue = value
createxmlHttpRequest()
var url = "请求页面 name= "+namevalue
xmlHttp.open( "get ",url , true)
xmlHttp.onreadystatechange = startCallback
xmlHttp.send(null)
}
startCallback()
{
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var agevalue = xmlHttp.responseXML.getElementsByTagName( "age ").item(0).firstChild.nodeValue
var obj = document.getElementById( "inputbox1 ")
obj.value = agevalue
}
}
}
</script>
...
<input type= "text " id= "inputbox1 " onChange=Start(this.value) />
...
$.ajax({type:'POST',url:'submitcomment.php',timeout:2000,cache:true,
data:'dataid='+dataid+'&appid='+appid+'&name='+name.val()+'&txt='+txt.val()+'&openid='+openid,
error:function(msg){return false},
success:function(json, st){
if(json.result == 0){
alert('您的评论审核通过后,才会显示出来!')
}else{ //否则审核通过,显示出来
$("#comlistx0014jwh62k").html(json)
}
}
})
后台submitcomment.php代码:
<?php
include("connect.php")//连接数据库文件
echo '<pre>',var_dump($_REQUEST['appid']),'</pre>'
echo '<pre>',var_dump($_REQUEST['name']),'</pre>'
die()
//mysql_query("INSERT INTO biao(name,txt) VALUES ('$_POST["name"]','$_POST["txt"]')
?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)