I want to pass the value of a dropdown in index.php
to a textbox in test.php
via Ajax.
Test.php
is iframed in index.php
. Once i change the dropdown, value of that dropdown needs to be updated in the test.php
without reloading the page.
Thanks!!
Index.php
<script type="text/javascript">
$(document).ready(function() {
$('#dropdown1').change(function() {
var value = $('#dropdown1').val()
window.location = 'index.php?value=' + value;
})
})
</script>
<body>
<h1>Ajax</h1>
<select id="dropdown1">
<option value="1">Value 1</option>
<option value="2">Value 2</option>
<option value="3">Value 3</option>
<option value="4">Value 4</option>
</select>
<div>
<iframe src="test.php" frameborder="0"></iframe>
</div>
</body>
Test.php
<body>
<?php
echo "<h1> The Current Value: " . $_GET["value"] . "</h1>";
?>
</body>