Jess McKenzie
Jess McKenzie

Reputation: 8385

jQuery showing Unexpected token ;

I was given the code below for an answer to another question I asked but its giving me Unexpected token ;. I have a feeling its missing closing ) but I have added them in and its still not resolved what have I missed.

Why am I getting Unexpected token ;?

Code:

<script>
    jQuery(window).on('click', '.add_to_cart.button', function() {
        call_ajax_add_to_quotelist(add_to_quotelist_ajax_url, $(this).data('id');
    }
    </script>

Upvotes: 2

Views: 60

Answers (2)

Kevin Bowersox
Kevin Bowersox

Reputation: 94429

The code is missing two closing parenthesis ) on this line:

<script>
  jQuery(window).on('click', '.add_to_cart.button', function() {
    call_ajax_add_to_quotelist(add_to_quotelist_ajax_url, $(this).data('id')); /added )
  }); //added );
</script>

Upvotes: 1

tymeJV
tymeJV

Reputation: 104775

Missing closing ) on the function call and at the end of the handler

jQuery(window).on('click', '.add_to_cart.button', function() {
    call_ajax_add_to_quotelist(add_to_quotelist_ajax_url, $(this).data('id')); //here
}); //and here

Upvotes: 3

Related Questions