There are two ways wo do it with that script!
1- Use hidden iframe.
Basicly, your form will contain a hidden input for the page you want to show after form submitted. Action target will be the hidden iframe. When form submitted, it will take action in the hidden iframe. And iframe will call another js function onload which calls the ajaxpage function (you cannot use ajaxpage function for a div in the parent frame from an iframe) ...
Form File :
HTML Code:
<script type="text/javascript">
<!--
function ajaxcaller(adress,division){
ajaxpage(adress,division);
}
// -->
</script>
<form action="takeaction.php" method="post" target="hiddenframe">
<input type="hidden" name="thenextpage" value="next.php" />
<input type="hidden" name="thediv" value="mydivid" />
</form>
<iframe style="display:none;visibility:hidden;" name="hiddenframe" id="hiddenframe"></iframe>
Action File Will Contain
PHP Code:
<body onload="javascript:window.parent.ajaxcaller('<?php echo $_REQUEST['thenextpage']; ?>','<?php echo $_REQUEST['mydivid'];?> ');">
Tried it, works...
2- If you have only a few form inputs this may be a little bit handy.
HTML Code:
<form onsubmit="javascript: var adres='targetPage.php?input='+document.getElementById('myOnlyInput').value; ajaxpage(adres,'TheTargetDivId');">
<input type=text id="myOnlyInput"/>
<input type="submit" value="submit"/>
</form>
Bookmarks