Reputation: 23969
I use the following to read variables from a URL:
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;
}
The URLs in question are set like this:
<a href="View?wl_id=' + i.event_id + '&title=' + encodeURIComponent(i.event_title) + '">
I have an example URL which is:
...&title=New%20clothes!
To see it I alert(decodeURIComponent($.urlParam('title')));
which shows New Clothes!
- perfect
I have another example which is:
...&title=Favorite%20Fragrances
This when alerted shows F
- that's it
Another example:
...&title=private%20testing
When alerted produces 0
Any ideas why they don't all produce what they should?
Upvotes: 0
Views: 73