thor
thor

Reputation: 3

jquery load URL Syntax error, unrecognized expression

Can't work out what's wrong with this code, this is the code for the URL but it's throwing a sytax error: unrecognized expression.

$(document).ready(function(){

$("a.qshop-btn").on('click', function () {

var $target = $(this).data('target');

var q = $(this).data('name');

var url = $('http://localhost/html/quickShop.php?q='+encodeURIComponent(q));

$("#qs-content").load(url, function (response,status,data) {

    $(".preloader").css('display','none');

    $($target).modal({ show:true });

        });
    });
});

Upvotes: 0

Views: 1365

Answers (1)

obe
obe

Reputation: 7788

You are trying to make the url into a JQuery object whereas it's a simple string. Just write it like this: var url = 'http://localhost/html/quickShop.php?q='+encodeURIComponent(q);

Upvotes: 2

Related Questions