Hi–
I have this button in a HTML/PHP contact form:
<input type=“submit” value=“Submit” />
Preceded by this script in the Head:
<script type=“text/javascript”>
$(function(){
$(’#contact-form’).submit(function(e){
e.preventDefault();
var form = $(this);
var post_url = form.attr(‘action’);
var post_data = form.serialize();
$(’#loader’, form).html(’<img src=“loader.gif” /> Please Wait…’);
$.ajax({
type: ‘POST’,
url: post_url,
data: post_data,
success: function(msg) {
$(form).fadeOut(500, function(){
form.html(msg).fadeIn();
});
}
});
});
});
</script>
That combination works to submit the contact form using a php file called process.php.
The problem is, I’d like to make that button into a LINK that does the exact same thing (my site doesn’t want a button there).
I have tried a javascript link, like so:
function submitform()
{
document.forms[“contact-form”].submit();
}
</script>
Followed by the js link:
<a href=“javascript: submitform()”>Submit This</a>
BUT this does not work to submit the form as the button does.
Is there any way to do this?
Many thanks for any help! I am ready to tear my hair out…