the following codes are what i'm trying to figure out.Hope you guys can help me !
jsp :
<input name="test" type="text" /><br/>
<input name="test" type="text" /><br/>
<input name="test" type="text" /><br/>
<input id="query" type="button" value="query" onClick="doajax()"/>
js :
function doajax(){
var dataSet = $("input[type='text'][name='test']").serializeArray();
$.ajax({
type: "post",
url: "<%=request.getContextPath()%>/testJson",
dataType: "json",
data:dataSet,
error:function(){
alert("error occured!!!");
},
success:function(data){
alert("success");
}
});
}
* [Update] *
I'm using Struts 2.0.
I usually get the parameters by " get and set " instead of request.getParameters().
How can i get the dataSet in Java Servlet ?
Thank you for reading !