我有这样的代码:
<script>
$("#mod").change(function() {
var matches=str.match(/(EE|[EJU]).*(D)/i);
$.ajax({
type="post",
url="process.php",
data="matches",
cache=false,
async=false,
success= function(res){
$('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>");
return this;
}
});
return false;
});
</script>
我想这段代码能显示结果normally..where是我的错吗?
发布于 2010-06-11 12:42:17
删除return
%s
和格式为( :
而不是=
)
$.ajax({
type:"post",
url:"process.php",
data:"matches=" + matches,
cache:false,
async:false,
success: function(res){
$('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>");
// return this; <<--- remove that too...
}
})
如果您希望使用data:"matches=" + matches,
将matches
作为数据传递...
而$_POST['matches']
是通过PHP获取值的方法。
发布于 2010-06-11 12:47:13
<script>
$("#mod").change(function() {
var matches=str.match(/(EE|[EJU]).*(D)/i);
$.ajax({
type:"post",
url:"process.php",
data:"matches="+matches,
cache:false,
async:false,
success: function(res){
$('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>");
}
});
});
</script>
https://stackoverflow.com/questions/3020225
复制相似问题