I am using jquery load to load another html page which contains js code and was to know what value has been passed.
var code = 1000
$('#content').load('forward.html?entity=' + code );
so far: I have got a function in forward.html, which is something like:
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
by calling getParameterByName (entity)
will not give me the value as expected but nothing as this function is reading the parameter string from the original calling page, (or what-so-ever is inside the URL address box).
Would someone please let me know how to resolve this problem? is there anyway to retrieve the parameter as expected? any JQuery function to do it so?