Ajax not working :(

No errors at all, the form just reloads the page (but with # at the end of the address). The form is basically a load of checkboxes and buttons but looks like the:

<form id="filter_form" method="post" action="#">
<input type="hidden" name="country" value="1">
<input type="hidden" name="order" value="">
<input type="hidden" name="muscle" value="on">
<div class="filter_title" style="padding-top: 10px;"><a class="nav_title" id="type_open" style="display: none;"><img src="/images/site/arrow_filter.png" height="9" width="9"> Type</a></div>
      <div class="filter_title"><a class="nav_title" id="type_close" style=""><img src="/images/site/arrow_open.png" height="9" width="9"> Type</a></div>
      <div id="type" style="">
                      <div class="filter_filters"><label for="Bar"><input type="checkbox" name="type_2" class="filter_link">Bar</label>
          </div>
                    <div class="filter_filters"><label for="Food"><input type="checkbox" name="type_3" class="filter_link" checked="">Food</label>
          </div>
                    <div class="filter_filters"><label for="Powder"><input type="checkbox" name="type_1" class="filter_link">Powder</label>
          </div>
                    <div class="filter_filters"><label for="Ready-to-Drink"><input type="checkbox" name="type_4" class="filter_link">Ready-to-Drink</label>
          </div>
                    </div>
            <div class="filter_title"><input name="Submit" type="submit" value="" id="filter_submit"></div>
          </form>

And is your JS at the bottom of the page, just before the closing </body> tag?

It wasn’t before but it is now and still doesn’t work :frowning:

You have an error there:

e.preventDefault

Missing (); after function name

The funniest part here is that is not an syntax error for JavaScript so script continues to execute.
But this line works not as it supposed to work (preventing form submission)

1 Like

Doh! The dreaded typo strikes again! Sorry guys

Yeah, sometimes I spend many hours trying to catch similar things in my own code =)
That sense when you create a super-complicated smart algorithm in 15 minutes and then waste 3 hours trying to solve why your link is red instead of green

2 Likes

Oh brilliant that’s now sending the AJAX in the background but it’s still not sending any of the post data though

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.