views:

660

answers:

1

After searching a lot over the internet I finally decided to post this question.

I am using THICKBOX jquery tabs.When any of the tab is clicked I want to pass the URL.IDNUMBER to the iframe which on tab pages . I was able to send the IDNUMBER and display it in a text box by simply using jquery on the main page

$("#mytest").val('IDNUMBER');

Tab Page:

<input id="mytest" name="IDNUMBER" type="text">

But am unable to pass the idnumber as a url parameter to the iframe.The tab page is an HTML page.

Thank You

A: 

Today I faced the same problem. I solved it with the following approach:

<iframe id="inviteFriendsFrame" src ="location_to_iframe?paremater1=value1&parameter2=value2" width="529px" height="300"></iframe>

Then inside the iframe we can parse the GET from javascript, I've used this

http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html

function getUrlVars() { // Read a page's GET URL variables and return them as an associative array.
    var vars = [],
        hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for (var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

so then I had all the get variables and therefore could do so something like:

parameters = getUrlVars(); //which leads to:
console.log(parameters['param1']); //Writes 'value1' to console

Hope I've helped. Please note that although the link is from a jQuery site, the code is generic JavaScript.

dimitris mistriotis