aRo`

automating your e-commerce

submit an ajaxForm from a hyperlink

Below you can find the democode for submitting a form from an hyperlink.
PLAIN TEXT
JavaScript:

$(document).ready(function() {

$('#addusertorunningform').ajaxForm({

target: '#add_user_to_running_status',

success: function() {

document.getElementById('add_user_to_running_status').style.display = 'block';}

});

 

$('a#submit_form').click(function() {

$("#addusertorunningform").submit();

});

 

});

PLAIN TEXT
HTML:

<div id="add_user_to_running_status">; <form id="addusertorunningform" action="http://domain.com/ajax/comment.php" name="addusertorunningform" method="post"> <input name="maptolink1" id="maptolink1" value="&lt;? print $mapid; ?&gt;" type="hidden" /> <a href="#" id="submit_form">test</a>

</form></div>

When you click on the link to # with the id "submit_form" it will [...]

For getting content from another page you only need 3 functions

1 custom function you can call in your code
1 for fetching the results from an external php file
1 for placing the fetched values in you original code

javascript

PLAIN TEXT
JavaScript:

function showDetails(){

    xmlHttp=GetXmlHttpObject()

    if (xmlHttp==null){

        alert ("Browser does not support HTTP Request")

    [...]