0

On the following website http://www.e-domov.cz/oblozkove-zarubne when you look to table "TYP"(TYPE in English) and change the radio button to the second one the javasscript dynamicaly generate text which you can see on the right panel.

It is happend by this part of code:

right3.php

Typ: <span id="zarubneStena"><?= $_SESSION['zarubneStena']; ?></span><br>

script.js

function nastavZarubneTyp2(value)
 {
$('#zarubneStena').html(value);
$.get("/C/AJAX/typZarubne2.php", { zarubne: value});
}

typZarubne2.php

<?php
     session_start();

      $_SESSION['zarubneStena']=$_GET['zarubne']; 
?>

oblozkove-zarubne.php

<td><input type="radio" name="typ<?php $uid=uniqid();echo $uid;?>" checked="checked" onClick="nastavZarubneTyp2('Na stěnu')"></td><td>Klasická obložková zárubeň</td>

<td><input type="radio" name="typ<?php echo $uid;?>" onClick="nastavZarubneTyp2('Do stavebního pouzdra');"></td><td>Obložková zárubeň pro posuvné dveře do stavebního pouzdra</td>

I don´t understand too much to this record:

 Typ: <span id="zarubneStena"><?= $_SESSION['zarubneStena']; ?></span><br>

So i want some advice how to dynamicaly get the value of $_SESSION['zarubneStena'] which is generated in real-time by javascript/AJAX. I know, it's difficult to understand what i want, but i hope, that somebody helps. Thanks too much.

1
  • 2
    Can't you just use $('#zarubneStena').val(); Commented Oct 31, 2012 at 9:21

2 Answers 2

1

You could have something as follows:

<?php session_start(); ?>

<div id="hiddenDiv" style="display:none">
    <?php echo $_SESSION['zarubneStena']; ?>
</div>

<script>
    var text; 
    text = $('#hiddenDiv').text();
</script>

Its kinda cheating mixing two technologies but it works ;-)

Also I wouldn't recommend the habit of

Sign up to request clarification or add additional context in comments.

Comments

0

<?= $_SESSION['zarubneStena']; ?> is being generated by php on the server side. the session is storing a key name 'zarubneStena' - but this is not what you asked for.

The code in the html page is sending the data:

<td><input type="radio" name="typ5090ee43d6d70" checked="checked" onClick="nastavZarubneTyp2('Na stěnu')"></td><td>Klasická obložková zárubeň</td>
<td><input type="radio" name="typ5090ee43d6d70" onClick="nastavZarubneTyp2('Do stavebního pouzdra');"></td><td>Obložková zárubeň pro posuvné dveře do stavebního pouzdra</td>

Notice the onClick="nastavZarubneTyp2('Na stěnu')" - this is what updates the text.

Its in oblozkove-zarubne.php and is the GET value of the key 'zarubne' - that SESSION['zarubneStena'] is set from.

Hope that helps. Maybe it just confuses.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.