function gotoClick(){
var url = 'jqueryAction.action';
var params = "aa";
var myAjax = new Ajax.Request(
url,
{
method:'post',
parmeters:params,
onComplete:processResponse,
asynchronous:true
});
}
请问这样传参在action里怎么才能取到parmeters的值。谢谢
var url = 'jqueryAction.action';
var params = "aa";
var myAjax = new Ajax.Request(
url,
{
method:'post',
parmeters:params,
onComplete:processResponse,
asynchronous:true
});
}
请问这样传参在action里怎么才能取到parmeters的值。谢谢
url,
{
method:'post',
parmeters:params,
onComplete:processResponse,
asynchronous:true
});
}
这个AJAX形式没见过 看形式传参数也没错啊 要么这么写也行 var url = "jqueryAction.action?paras="+paras;祝你好运
鉴于你的写法, 就添加属性就可以了.! LZ的ajax用的是prototype吧.?
<script type="text/javascript">
function gotoClick(){
var params = "aa";
var url = 'jqueryAction.action?name='+params;
var myAjax = new Ajax.Request(
url,
{
method:'post',
parmeters:params,
onComplete:processResponse,
asynchronous:true
});
}
function processResponse(request){
$("show").innerHTML = JSON.parse(request.responseText).result;
}
</script>
action类:
public String execute(){
System.out.println("params==" + getParams());
System.out.println("parmeters==" + getParmeters());
HttpServletRequest request = ServletActionContext.getRequest();
System.out.println(request.getParameter("params"));
result = "ajax测试";
return SUCCESS;
}
result可以正常返回页面并显示出来,但是三种输出到控制台没一个好用的。
--
或者你在action中打印获取从页面传来的json。看其具体内容。
LZ实在不行, 把post和parameters都去掉, 在url后面传值看收不收得到