I have a form in AngularJS application. I need to auto submit this form upon page load without using jquery because of cross domain issue.
When I submit the form by using a submit button it works and the target url loads in the browser. If I remove the submit button and try to submit in the onload event, it does not work. The page displays just ";". Any idea why onload does not work here? Thank you!
<form name="myForm" method="post" action="@Model.Settings["URL"]" ng-controller="PostCtrl">
<input type="hidden" name="Name" value="{{Details.Name}}">
<input type="hidden" name="Amount" value="{{Details.Amount}}">
@*<button type="submit" class="action blue"><span class="label">Click here</span></button>*@
<script>
window.onload = function () {
document.myForm.submit();
}
</script>
</form>