29
Jun
Posted by aRo` as ajax, jQuery
Below you can find the democode for submitting a form from an hyperlink.
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();
-
});
-
-
});
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="<? print $mapid; ?>" 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 use the jQuery framework to the submit form code ($("#addusertorunningform").submit();).
RSS feed for comments on this post · TrackBack URI
Leave a reply