jQuery - passing querystring values to $(selector).load(url); not working -
i have following lines of code:
var search = $("#txtsearch").val(); search.replace(" ", "%20"); $(".header").html("/parts/search.php?type=" + $("input[name=type]:checked").val() + "&q=" + search); $(".main-content").load("/parts/search.php?type=" + $("input[name=type]:checked").val() + "&q=" + search);
i know there textbox id specified in first line, , 2 inputs of type radio name set type. value passed type either postcode or normal. correct output (as far can see) being displayed in elements satisfying .header selector. page not loading .main-content. there page, called search.php, user taken if js disabled (i.e. there submit button submits /search.php through method - disappears , search link appears if js enabled). if page has 2 querystring parameters specified include /parts/search.php. works fine - reads querystring parent (root level) search.php. dont why wont work jquery though. have ideas?
thanks in advance,
richard
ps have tried attaching value of search box on end of url, without storing in variable , replacing space... didnt work either.
line 2 looks suspicious me. replace returns value. try this.
search = search.replace(" ", "%20");
Comments
Post a Comment