Tuesday, December 20, 2022

[FIXED] Where is the syntax error located in this JavaScript code?

Issue

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) {

Solution

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',


Answered By - freefaller
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.