In the following example am submitting a serialized form using post method. Its working fine now. But I want to pass some more extra parameter to the submitted page. How to pass that value to the form. I dont like the way to keep that value in a hidden field in that form. Is there any other way to do this?
var postUrl = 'myphppage.php';
$.post(postUrl,
$('#myForm').serialize(),
function(response) {
if(response.status){
//do something
}else{
}
},'json'
);
Just add simply like how you do string concatenation. For eg., you wanna add a parameter, username
with the value praveen
, you can do this way:
$.post(postUrl,
$('#myForm').serialize() + '&username=praveen',
function(response) {
if(response.status){
//do something
}else{
}
},'json'
);
But just make sure you URLEncode the values and keys.