In the past, whenever I needed to get the value of an html element, I would always submit a form to load a different page. Something like:
page1.php
<form name="form1" action="page2.php" method="post">
<input type="hidden" name="input1" value="value1" />
</form>
page2.php
<?php
$data = $_POST['input1'];
?>
My question is, is it possible to get the value of ‘input1’ on the same page (page1.php) without requiring clicking a submit button?
With jQuery:
Non-jQuery IE doesn’t have the XMLHttpRequest object so here is a shim for IE: