I want to submit a form using jquery .post(). I want to send all the input names in addition to another parameter, in there any way to send data and the request?
$.post("RegistrarManagementServlet",{"option":"cancelRequest"},function(){
alert("hi");
});
here is how we submit the request
$.post("RegistrarManagementServlet",request,function(){
alert("hi");
});
I want to send all the data in the form (in the normal post request) in addition to option parameter, how can I make it?
EDIT
where should I define the request as function parameter, since the code occurs after confirmation dialog appear
$('#cancelRequest').click(function(event){
event.preventDefault();
jConfirm('Are you sure to delete registrar request?', 'Confirmation Dialog', function(result) {
if(result == true){
request.cancelRequest="cancelRequest"; //request is not defiend
$.post("RegistrarManagementServlet",request,function(){
alert("hi");
});
}
});
You can make name value pair by using following code
then post your request just the way you do.
Or you can see the example at
http://www.codeunit.co.za/2009/11/04/jquery-iterate-through-a-forms-elements/
for a Jquery way to do the same