I have a form in my html page and for some reason with the jquery command it won't stop reloading the page. I've tried removing the post method adding javscript:void(0)
. Changed
$('like_unlike').submit(function( event ) {
event.preventDefault();
});
to
$('like_unlike').on("submit", function( event ) {
event.preventDefault();
});
I don't understand I can't get the form to send a post request to my php side without relaoding the page. I'm using ajax to send a post request but either the page "sends" and changes the page to expired or nothing happens.
Here is my HTML
<form id="like_unlike">
<input type="hidden" name="art" value="">
<input type="image" onclick="likeButton()" class="article-like pl-2 float-right" src="" alt="" id="unlike">
<input type="image" onclick="unlikeButton()" class="article-like pl-2 float-right" src="" alt="" id="like">
</form>
I'm using Laravel 5.8
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire