Guys I have the following simple form:
<form action="?edit-form" method="post" enctype="multipart/form-data" class="edit">
<img src="test.jpg" alt="">
<input type="submit" name="delete-image" value="Delete Image"><br>
<input type="submit" name="Go" value="Go">
</form>
And this jQuery:
$(document).on('submit', '.edit', function(e) {
$.ajax({
url: $(this).attr('action'),
type: $(this).attr('method'),
data: $(this).serialize(),
success: function(html) { }
});
$("img").attr("src", "deleted.jpg");
e.preventDefault();
});
The jQuery works great, except that I would like it to work only when the "delete-image" button is pressed, not when "Go" is pressed. How do I do this? Right now, the AJAX triggers on submit, I would like it to trigger when "delete-image" is clicked.