CodeIgniter Forums

Full Version: jTip and Codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hello all. I'm trying to use the jquery plugin jTip and I have it working. The only issue is I don't know how to pass any query params to the jquery to specify the width of the tooltip. I know where in the jquery it defines the width, but I don't know how to read my 1st query param using jquery seeing as how jTip is using key=>value pairs such as "?width=300"

I know I can go into the plugins code and parse the url that gets passed to it to extract what I need, but It occured to me that there must be away to pull query string variables using jquery in an easy fashion while using urls that are like codeigniter's default url structure.

This below, just happens to be an example I am currently working on that would need such a thing.

The line of jquery that defines the default width is as so:
var queryString = url.replace(/^[^\?]+\??/,'');
var params = parseQuery( queryString );

if(params['width'] === undefined){params['width'] = 250};

The way you are innately supposed to call jTip is with a line like this:
<a href="ajax.htm?width=375" class="jTip" id="one" name="Password must follow these rules:">?</a>

I've modified it a bit and am using this line:
<a href="&lt;?php echo base_url(); ?&gt;admin/tips/main_tooltip/375" class="jTip" id="main_tooltip" name="The title of tip goes here">?</a>

Thank you, Dan