plugins_url() returns incorrect url

I use this line of code in my wordpress plugin:

jQuery.get(<?php echo plugins_url() . '/FixFormData/getuser.php'; ?>, { q: str }, function(response){
                    var parsed = JSON.parse(response);
                    var arr = [];
                    for(var x in parsed){ arr.push(parsed[x]);}
                    jQuery('#input_1_3').val(arr[1]);
                    jQuery('#input_1_4').val(arr[2]);
            });

This line doesn’t return the correct url:

Read More
<?php echo plugins_url() . '/FixFormData/getuser.php'; ?>

I get the following error on my website:

SyntaxError: missing ) after argument list

jQuery.get(http://*****.be/wp-content/plugins/FixFormData/getuser

I am, however, not missing a ‘)’ anywhere….

When i just use http://*.be/wp-content/plugins/FixFormData/getuser.php in the jQuery.get, evrything works fine.

Related posts

Leave a Reply

1 comment