aRo` automating your e-commerce

29Jun/07
This blog has been neglected due to the success of Solidshops.com

submit an ajaxForm from a hyperlink

Below you can find the democode for submitting a form from an hyperlink.

JavaScript:
  1. $(document).ready(function() {
  2. $('#addusertorunningform').ajaxForm({
  3. target: '#add_user_to_running_status',
  4. success: function() {
  5. document.getElementById('add_user_to_running_status').style.display = 'block';}
  6. });
  7.  
  8. $('a#submit_form').click(function() {
  9. $("#addusertorunningform").submit();
  10. });
  11.  
  12. });

HTML:
  1. <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>
  2. </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();).

Popularity: 2% [?]

Filed under: ajax, jQuery Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.