Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:31:53+00:00 2026-06-01T17:31:53+00:00

I have been looking for a way to add the information (string) from a

  • 0

I have been looking for a way to add the information (string) from a variable in the previous page.

As far as I know this should be possible using javascript somehow.

New one couldn’t get the old one to work properly..

<script type="text/javascript">
function newPopup(url) {
    popupWindow = window.open(
        url,'popUpWindow','height=510,width=350,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
<a href="JavaScript:newPopup('(url)');">Armory Avatar</a>

I have that piece of code that opens the link into a new popup window(which remembers the url of the previous page).
In this window people can insert some information about there WoW character and the realm this character is on. After they do this and hit submit the site displays the url for the avatar retrieved from the blizzard armory.

http://eu.battle.net/static-render/eu/(imagepath)

Code for the popup page: Updated this current code (7-4-2012)

   <?php
if (!isset($_POST['submit'])) { 
?>
<!-- The fill in form -->
<html>
<head>
<title>Armory Avatar</title>
</head>
<body>
<form method="post" action="<?php echo $PHP_SELF;?>">
Character Name:<input type="text" size="12" maxlength="50" name="cname"><br />
Realm Name:
<select name="rname">
<optgroup label="English Realms">
<option value="aerie-peak">Aerie-Peak</option>
<option value="agamaggan">Agamaggan</option>
<option value="aggramar">Aggramar</option>
etc etc etc.
</optgroup>
</select><br />
<input type="submit" value="submit" name="submit">
</form>
<?php
} else {  //If form is submitted execute this

    $charname = $_POST["cname"]; //input character name
    $realmname = $_POST["rname"]; //input realm name

    $charurl = urlencode(utf8_encode($charname)); //prepares character name for url usage
    $realmurl = 'http://eu.battle.net/api/wow/character/'.$realmname.'/';  //combines the basic url link with the realm name
    $toon = $realmurl.$charurl; //adds the charactername behind the realm url
    $data = @file_get_contents($toon); //retrieves the data from the armory api
        if ($data) {
            // if armory data is found execute this 

            $obj = json_decode($data); //converts the data from json to be used in the php code ?>
            <img src='http://eu.battle.net/static-render/eu/<?php echo $obj->thumbnail; ?>'> </img><br /> <?php //Is url link to image 
            $armoryname = utf8_decode($obj->name); //makes the name readable again
            echo "Name: " . $armoryname . "<br />";  //character name
            echo "Level: " . $obj->level . "<br />";  //character level
            echo "Achievement Points : " . $obj->achievementPoints . "<br />"; //Achievement Points
            if ( $obj->gender == 1 ){  //Deteremines the gender of the character
                echo "Gender : Female <br />" ;  //displays gender as female
            }else{
                echo "Gender : Male <br />" ; //dispalays gender as male
            } 
            $image = "http://eu.battle.net/static-render/eu/".$obj->thumbnail;
            ?>
            Image: <a href='http://eu.battle.net/static-render/eu/<?php echo $obj->thumbnail; ?>'> http://eu.battle.net/static-render/eu/<?php echo $obj->thumbnail; ?></a><br /> 


            <!--Button submit code-->

            <script type="text/javascript">
            $('button.cancel_link').click(function() {

            // Change the value of the input with an ID of 'avatarurl'
            // with the dynamic value given to you by the external JSON link

            window.opener.getElementById('avatarurl').value = '<?php echo $image; ?>';

            });
            </script>
            <input> <!-- The button here -->



        <?php   



        }
        else { // if armory data is not found execute this  ?>

            error code stuf
        }
}
?>

Now i need this line of code:

$image = “http://eu.battle.net/static-render/eu/“.$obj->thumbnail;

To be returned when the window is closed or simply by hitting another submit button(prefered to happen on close over button). And when either of those happen it needs to insert this into this string:

<input type="text" class="textbox" name="avatarurl" size="25" maxlength="100" value="{$avatarurl}" /></td>

The texbox called avatarurl.

Hopefully any of you know how to modify or create a javascript that does this for you. Since my php is already severely limited and my javascript knowledge is next to none.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:31:54+00:00Added an answer on June 1, 2026 at 5:31 pm

    You need to modify the way you’re closing your pop-up window. Try something like this:

    // When a BUTTON with the class name 'cancel_link'
    // is clicked, it activates the following
    
    $('button.cancel_link').click(function() {
    
       // Change the value of the input with an ID of 'avatarurl'
       // with the dynamic value given to you by the external JSON link
    
       window.opener.getElementById('avatarurl').value = '<?php echo $image; ?>';
    
    });
    

    You need to make sure your closing link has cancel_link as its class name, and that your input element in your parent document has an id of avatarurl.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking for a way to remove an attachment from Jira using
I've been struggling looking for an understandable way to do this. I have four
I have been looking for a easy way to add borders to custom made
I have been looking for an elegant and efficient way to chunk a string
I have been looking at a way to add autocomplete functionality to a formtastic
I have been looking for a way to get rid of the nasty black
I have been looking for a way to allow users to manually override geolocation
Have been looking at the MVC storefront and see that IQueryable is returned from
I have been looking for documentation related to interacting with MSPaint from the command
I've been looking on SO this morning to find a way of creating a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.