I am writing a web application and had a question regarding the best was to append values to an HTTP Post.
For my get requests, I am using jQuery to append auxiliary data using .load as indicated here
$('#contentPane').load(url, 'subop='+subOp);
As you can see I am sending along extra value’s with my get requests that controller Servlet uses to send back the right data.
In addition to the get requests, I would like to add some extra data to my forms so that I can have Servlet controller perform the appropriate tasks.
Is the best way to do this by adding a hidden field to HTML?
<input type="hidden" name="Language" value="English">
If it helps, here is what I am doing with my jQuery submits …
$('form').live('submit', function(e) {
var formData = $('form').serialize();
....
....
$.ajax({
type: "POST",
url: "/netcomm/controller",
//data: "password="+password+"&firstName="+firstName,
data: formData,
success: function(msg){
alert( "Data Saved: " + msg );
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
Any advice regarding the best way to do this is much appreciated …
Thanks so much!
Aryeh