I have a such form with many links:
<form name="myform" action="" method="get" id="form">
<p>
<a href="getValue('A')" class="del">My link</a>
</p>
<p>
<a href="getValue('B')" class="del">My link 2</a>
</p>
<p>
<a href="getValue('C')" class="del">My link 3</a>
</p>
<input type="hidden" name="division" value="" />
</form>
I would like to send the form’s value from the link that was clicked to php script and get the response (not reloading the page).
I’m trying to write a function that gets the value from a link:
<script type="text/javascript">
window.addEvent('domready', function() {
getValue = function(division)
{
var division;
division=$('form').getElements('a');
}
</script>
but I don’t know how to write it in a right way. Next I would like to send the form:
$$('a.del').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
$('form').submit();
});
});
How I should send it to get the response from a php file not reloading the page?
This works for me: