Query string null in redirects

Posted by Vuyiswamb under JavaScript on 1/15/2014 | Points: 10 | Views : 707 | Status : [Member] [MVP] [Administrator] | Replies : 0
Good Day All

it has been a long day , i hope you had a good one. I am a bit tired, i need some help in the following



I have two pages.On Page 1 there is an onready even and there is a check that i do ,The Check is for a Query string , i am checking the querystring has value like this , if it has a value then redirect to Page2 and Pass the parameter.



function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}


$(document).ready(function ()
{
//Usage
var message = getParameterByName('cuid');

if (message != null)
{
window.location = "Page2.html?cuid=A1E428F5-6D6B-4A40-854B-3B0E01BBA790";
}
});


Now on Page2 i check if there is Query string "cuid" and i check if its not null as i did below



$(document).ready(function ()
{
//Usage
var message = getParameterByName('cuid');
alert(message);

if (message == null) {

window.location = "Page1.html";

}


});



if its null i redirect to Page1, now my problem here is that i can see it redirect to Page2 , but imidiately it gets redirected to Page1 , the Querystring is null even if i have supplied it.



Please Help



Thanks

Thank you for posting at Dotnetfunda
[Administrator]



Responses

(No response found.)

Login to post response