I have jQuery script that takes a URL parameter and adds the value to an input box.
When the URL is the form of www.mysite.com/page/?number=10 everything works fine. When the url includes .php at the end of the page than the script doesn't work, e.g. www.mysite.com/page.php?number=10.
I need for the script to work with .php is used.
Here is the script:
jQuery(document).ready(function() {
(function($) {
jQuery.QueryString = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=');
if (p.length != 2) continue;
b[p[0]] = decodeURIComponent(p[1].replace(/+/g, " "));
}
return b;
})(window.location.search.substr(1).split('&'))
})(jQuery);
jQuery.QueryString["number"];
jQuery("#entry_2081224724").val(jQuery.QueryString["number"]);
});
+that means "1 or more" of the expression preceding it. But you mean the+literally, so you should escape it like so\+.