/* ===========================================================================
*
* Elqua JQuery Querystrings Parser
* Version 1.1
* Parses URLs and provides easy access to information within them.
*
* Author: Adrian Lyons
* Author email: adrian.lyons@eloqua.com
* ---------------------------------------------------------------------------
*
*SUPPORT:
*
* Released as is. No direct support is provided regarding the use of, or editing of, this plugin.
* No support is provided by Eloqua for the jQuery framework.
*
*
*RELEASE HISTORY:
* v 1.0 - Initial Release
* v 1.1 - Added support for querystring values with URL encoded characters in them. Will not output the URL encoded characters.
* (I.E. "first%20query%20string%20value" will be displayed as "first query string value"
*
* ---------------------------------------------------------------------------
*
* EXAMPLES OF USE:
*
* Upload a copy of the jQuery JS Library and the Eloqua querystring plugin to your content upload section. Use the direct link to the
* file and add the link to the file in your landing page.
*
* To populate form fields with queerystirng values, add the following lines to the header scripts file. Make changes to the code wrapped with
* { }.
*
*
*
*
* Or
*
* Add to any part of the page where you want the querystring's value to be displayed or used in a script.
*
*
*/
jQuery.fn.querystrings = function(name){
target = this;
qs = new RegExp('[\\?&]' + name + '=([^]*)').exec(window.location.href);
jQuery(this).val(decodeURI(qs[1]));
}
jQuery.querystrings = function(name){
target = this;
qs = new RegExp('[\\?&]' + name + '=([^]*)').exec(window.location.href);
document.write(decodeURI(qs[1]));
}