AJAX why on first form doesnt redirects on second button redirects ?
I have this form here:
- <form id="voteUp" action="/minus-rep/{{$s->id}}" method="get">
- <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-thumbs-down"></i> <strong>Nerekomenduoti</strong></button>
- </form>
And this is my jQuery code:
- $(document).ready(function(){
- $("#voteUp").submit(function(evt){
- evt.preventDefault();
- var formData = $(this).serialize();
- var url = $(this).attr("action");
- $.get(url, formData, function(response){
- $("#votes").html(response.newNumber);
- });
- });
- });
This is how my page looks:
When I press green button the number gets +1, page don't redirects, it works perfect. But if I press red button then the page redirects and shows this:
But it also adds the number, but the problem is that the red buttons are redirecting. Can u suggest something ?