0

OK, I found this code on another thread

How can I get query string values in JavaScript?, and it's been very helpful in location a string value in a URL. Now I need to take that string value, and use it to open a dialog box.

Here is the original code to get the string value

 function getParameterByName( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}

and here is the code I've written to search for the string, and open the dialog box, and yet it is not doing that.

var signup_param = getParameterByName( 'Redirect' );
if (signup_param == "signup") {
$('#emailDuplicateDialog').dialog('open');
}

The URL I'm working with btw ends with login.html?redirect=signup so redirect is the name, and signup is the value.

Any suggestions on changes to make this work would be a great help.

Thanks.

Community
  • 1
  • 1
Jack Parker
  • 547
  • 2
  • 9
  • 32

1 Answers1

1

getParameterByName( 'Redirect' ) shouldn't be getParameterByName( 'redirect' )?

Also, you can debug the variable signup_param to see it's value.

fonini
  • 3,243
  • 5
  • 30
  • 53