<script type="text/javascript"> jQuery(function () { var name = GetParameterValues('name'); //var sku = GetParameterValues('sku'); jQuery('#product_name').val(decodeURIComponent(name)); }); function GetParameterValues(param) { var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < url.length; i++) { var urlparam = url[i].split('='); if (urlparam[0] == param) { return urlparam[1]; } } } </script>
Note: In above code i use a function named decodeURIComponent() this function give the query string data with spaces