How can I use a variable as a jQuery option value?

Posted by mattgorecki on Stack Overflow See other posts from Stack Overflow or by mattgorecki
Published on 2010-06-02T16:22:57Z Indexed on 2010/06/02 16:23 UTC
Read the original article Hit count: 104

Filed under:
|

I currently have jQuery code that looks like this:

if ($.url.param("s") == "error") { $.gritter.add({ title: 'Error!', text: $.url.param('message') }); }

I'm checking to see if the request variable s exists in the url (ie. http://example.com/?s=error&message=this%20is%20my%20message and then showing a popup message that contains information from request variable message.

The popup works just fine, but the message variable isn't populated, the plugin asks for a string as a value for the text option. What is the proper way to grab the message variable?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery