Ok Im am so very lost on what to do now, I have written the php code and would like to display the contents of what is being echoed through the url.

Example is by entering
mywebsite.com/index.php?dog=dogs it returns "a dog"
mywebsite.com/index.php?dog=littledog returns "a little dog"

What I would like to do is display the output of the urls to my webpage using javascript in popups. I have the pops written already I just need to be able to display the output.

Please note that some of the pages are html so I would like to do this in javascript.

Any help would be more than appreciated.

Thank you.

Hey.

You can get the GET parameters from the window.location.search element, which you can then parse and use in your Javascript code.

For example:

var $_GET = {};
window.onload = function()
{
    // Parse the GET parameters into the $_GET global.
    var parts = window.location.search.toString().substring(1).split("&");
    for(var i = 0; i < parts.length; ++i) {
        var pair = parts[i].split("=", 2);
        if(pair.length == 2) {
            $_GET[pair[0]] = pair[1];
        }
    }

    // See if the dog value is in the $_GET array and print
    // the results into the output element.
    var output = document.getElementById('Output');
    if($_GET['dog']) {
        switch($_GET['dog'])
        {
            case 'dog':
                output.innerHTML = "A dog.";
                break;
            case 'littledog':
                output.innerHTML = "A little dog.";
                break;
            default:
                output.innerHTML = "Mystery dog.";
        }
    }
    else {
        output.innerHTML = "No dog passed.";
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.