I am not able to submit the code I am writing using jQuery. This is being used in congestion with JSP on the Hybris platform.
The button click event is happening as expected, but for some reason, the form is not being submitted.
//option-1
$("#jsContinueButton").on("click",function(e){
e.preventDefault();
$("#MyAddressForm").submit(function(event){
event.preventDefault();
});
});
//option-2
$("#jsContinueButton").on("click",function(e){
e.preventDefault();
$("#MyAddressForm").submit();
});
<form:form action="/cart/update" method="post" commandName="MyAddressForm" id="MyAddressForm">
<div class="selected-address-data-container" style="display: none;">
<input type="hidden" data-old="" name="line1" id="address1" value="address 1" />
<input type="hidden" data-old="" name="line2" id="address2" value="address 2" />
<input type="hidden" data-old="" name="suburb" id="suburb" value="suburb" />
<input type="hidden" data-old="" name="townCity" id="towncity" value="city name" />
<input type="hidden" data-old="" name="postcode" id="postcode" value="postcode" />
<input type="hidden" data-old="" name="meshblock" id="meshblock" value="" />
<input type="hidden" data-old="" name="gps_lat" id="gps_lat" value="123.12" />
<input type="hidden" data-old="" name="gps_long" id="gps_long" value="123.23" />
<input type="hidden" data-old="" name="dpid" id="dpid" value="" />
<input type="hidden" data-old="" name="sufi" id="sufi" value="" />
<input type="hidden" data-old="" name="rdNumber" id="rdNumber" value="" />
<input type="hidden" data-old="" name="rural" id="rural" value="false" />
<input type="hidden" data-old="" name="boxType" id="boxType" value="" />
</div>
</form:form>
I am not able to find any reason why the form is not submitting. I expect it to make a network call for action URL.