arrays - How to change Jquery ajax get params to ajax post params, like '?name=2&name=3&name=4'? -
i wanna post lot of same field values server in jquery ajax, can via adding values url, wanna know how using data attribute. there must have equal way.
$.ajax({ type : "post", url : 'abc.action?name=5&name=6', data : { name : 2, name : 3 }, error : function() { console.error("operate failed"); }, success : function(data) { console.log(data); } });
in above code, request send 5, 6 , 3 server, not 2.
maybe problem different using different server side, use struts2.
you seem looking array
.
just define variable name
array. , push values it, , once has values send in ajax
request.
name = []; name.push("2"); name.push("3"); $.ajax({ type : "post", url : 'abc.action', data : { name : name }, error : function() { .....
Comments
Post a Comment