开发者_JS百科every request with country name as an one word goes through, only "united kingdom" doesn't.
$("#content").load('view.php?country=united kingdom');
many thanks
Escape United Kingdom using encodeURIComponent
, mainly to replace the space with a plus sign.
Example:
country = "united kingdom";
$("#content").load('view.php?country=' + encodeURIComponent(country));
Alternatively, use the .load
data parameter, which is automatically escaped.
$("#content").load('view.php', { country: "united kingdom" });
Try with encodeURI:
$("#content").load(encodeURI('view.php?country=united kingdom'));
精彩评论