-1

I have a syntax problem somewhere but can't spot it as I am not a javascript developer. Can someone with a better eye point out the problem?

$.ajax(
    {
        type: 'GET',
        url: / + 'modules/blocklayered/blocklayered-ajax-back.php',

Uncaught SyntaxError: Unexpected token ILLEGAL

        data: (all ? '' : $('input[name="categoryBox[]"]').serialize()+'&')+(id_layered_filter ? 'id_layered_filter='+parseInt(id_layered_filter)+'' : ''),
        success: function(result) {
1
  • 3
    Start by formatting your code properly.
    – j08691
    Jan 13, 2014 at 18:06

2 Answers 2

2

The syntax error is on this line...

url: / +     'modules/blocklayered/blocklayered-ajax-back.php',

The / is misplaced, and should be...

url: '/modules/blocklayered/blocklayered-ajax-back.php',
1
  • Thanks - I discovered that the typo is generated in my PrestaShop backoffice because my url contains an extra directory that should not be there. Jan 24, 2014 at 21:00
1

You have a typo in your url: parameter:

$.ajax({
    type: 'GET',
    url: / +     'modules/blocklayered/blocklayered-ajax-back.php',
      // ^^ here
    data: (all ? '' :     $('input[name="categoryBox[]"]').serialize()+'&')+(id_layered_filter ?    'id_layered_filter='+parseInt(id_layered_filter)+'' : ''),
    success: function(result) {

The correct code should be:

$.ajax({
    type: 'GET',
    url: '/modules/blocklayered/blocklayered-ajax-back.php',
    data: (all ? '' :     $('input[name="categoryBox[]"]').serialize()+'&')+(id_layered_filter ?    'id_layered_filter='+parseInt(id_layered_filter)+'' : ''),
    success: function(result) {

Not the answer you're looking for? Browse other questions tagged or ask your own question.