3
I’d like to send a form
without clicking the button submit
, using the jQuery click event, I tried this way but I did not succeed:
$(document).ready(function() {
$('.item').click(function() {
var id = $(this).attr('rel');
var form = $("#form_" + id);
form.submit(function() {
alert('pronto!');
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<form id='form_7' action="" method='POST'>
<input type='text'>
</form>
</div>
<button class='item' rel='7'>Botão</button>
Thank you in advance
Sergio, good afternoon to you. I would like to send the data using ajax, I can do this by clicking on Ubmit, like this: https://www.dropbox.com/s/gciuolhaxt60je3/js?dl=0 Now if I create an event as I informed I can’t do it
– Tales Breno
@Maybe because you don’t: https://jsfiddle.net/1z2wc5j5/1/ ?
– Sergio
His last suggestion worked, I only had to make an adaptation in my ajax file (which does not imply the success of his suggestion), which was where the error was. Thank you very much! D
– Tales Breno
@Talesbreno great! I’m glad I helped.
– Sergio