<script src='http://localhost/jquery.js'></script>
<script>
function vote(){
jQuery.ajax({
type: "POST",
url: "http://localhost/a.php",
data: jQuery("form[id=vote]").serializeArray(),
dataType: "json",
cache: false,
success: function(json){
alert("感谢投票,投票成功");
}
});
alert($("#xx").val());
}
</script>
<form action="a.php" method='post' id="vote" onsubmit="vote();return false;">
<input type="text" id="xx" value="提交投x票" />
<input type="submit" name="submit" value="提交投票" />
</form>感谢投票,投票成功 这句不alert。请问哪里错了?
<script>
function vote(){
jQuery.ajax({
type: "POST",
url: "http://localhost/a.php",
data: jQuery("form[id=vote]").serializeArray(),
dataType: "json",
cache: false,
success: function(json){
alert("感谢投票,投票成功");
}
});
alert($("#xx").val());
}
</script>
<form action="a.php" method='post' id="vote" onsubmit="vote();return false;">
<input type="text" id="xx" value="提交投x票" />
<input type="submit" name="submit" value="提交投票" />
</form>感谢投票,投票成功 这句不alert。请问哪里错了?
解决方案 »
- this 参数的问题
- JS 计算的结果 保留两位小数
- 求这样的层代码
- realplayer的网页插件如何以原始尺寸播放?
- 请问jquery中这个拾取表达式是什么意思
- IE上不能正常运行,而FireFox上可以。求解决方法!
- var global = (function () { return this || (1, eval)('this'); }())这个怎么理解?
- 原创:JavaScript如何实现“面向对象”的各种特征
- 获取json数据是出现的问题
- 请问这个语句的值:var a = document.getElementById("abc").id;
- jquery treeview, 点击+-号才展开,如何实现?
- 帮忙解释一下这段退出弹出提示的代码?
查一下单独运行a.php有没有错误?
数据是否递交了?jQuery("form[id=vote]").serializeArray()为空
<input type="text" id="xx" name="xx" value="提交投x票" />
这样,建议装个IE8或FIREBUG(FIREFOX) DEBUG一下就知道了.程序似乎没错.