the <script>
$( document ).ready(function() {
$("button").click(function(){
sendAjaxForm('ajax_form', btn);
return false;
}
);
});
sendAjaxForm function(ajax_form, btn) {
$.ajax({
url: '/getvote',
type: "POST",
dataType: "json",
data:
$("#"+ajax_form).serialize(),
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
success: function (data) {
},
error: function (er) {
}
});
}
</script>
Find more questions by tags jQueryJavaScriptAJAX
Here buttons below form with indoor input
<input type="hidden" name="vote" value="">
how to pass the value in the value? - Rahul_Jones commented on April 19th 20 at 12:37
- Jasper_Kunze commented on April 19th 20 at 12:40
so, no need to data transfer - Rahul_Jones commented on April 19th 20 at 12:49
you in #ajax_form added ? What do you have in console? Why didn't codepen if you want to help ?
However, you know better .Pass data! - Jasper_Kunze commented on April 19th 20 at 12:52