thor thor - 7 months ago 42
jQuery Question

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.


$("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) {


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


obe obe

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