I have a MVC View that generates multiple Ajax.BeginForm, with a button in them that calls a function in the Controller that returns a Partial View. The UpdateTargetId is set to the ID of a Div. It works fine if I manually click the button, but if I use this code…
<script type="text/javascript">
$(document).ready(function () {
$(".submitButton").click();
});
</script>
Then it clicks the button alright, but it opens the Partial View in a new page… Why does this happen, and how can I fix this?
You probably want to submit the form directly, instead of clicking the submit button. perhaps
Will help with what you’re after.