I have a symfony Form into a Template:
Template.php
<form class="well" action="<?php echo url_for("@submitParam?param=".$con) ?>" method="post">
<input type="text" name="param">
<button type="submit" class="thisBtn">Button</button>
</form>
How can i pass a value from the HTML Input name="param" to the url or to the variable $con with jquery, javascript or with any other Ways(symfony or php) when pressing on the Submit Button?
Update :
You can also do it with AJAX:
$(".btn").live('click', function(){
$.post("<?php echo url_for('@submitParam'); ?>", $('.box').serialize(), function(response) {
switch(response.status) {
case 'success':
console.log("Success");
break;
case 'failure':
console.log("Failure");
break;
}
}, 'json');
return false;
});
Action :
$request->getParameter('param');
to send
paramvalue in url, use submit buttonand change method to get
method="get"