I have a question on how to call a view function from a template HTML button? Like an onclick function? Here is the template:
One option is, you can wrap the submit
button with a form
Something like this:
(remove the onclick
and method
)
If you want to load a specific part of the page, without page reload - you can do
and on a submit
listener
$(function(){
$('form').on('submit', function(e){
e.preventDefault();
$.ajax({
url: $(this).attr('action'),
method: $(this).attr('method'),
success: function(data){ $('#target').html(data) }
});
});
});