After your comment that you do not know about the action="javascript:void(0);" part in your code, here an answer:
If you just need to submit a form, just add the URL as action and the correct method as required by the server. Unless you need to run business logic between the user action and the actual submit to the server, the default browser behavior (without js) works just fine?
Example:
<form role="form" class="registration-form" method="POST" action="/register">
action can be either relative, absolute or a complete URL including protocol and host. However, any GET parameters will be discarded (no matter which method is used to submit). If you need to submit any additional parameters, you have to add them as hidden inputs to the form (or you add them in the AJAX call, if you choose the JS solution).
If you need to run business logic in between the user's submit action and the actual POST or GET to the server, you can either leave the action as is or replace it with #.
<form id="registation-form" role="form" class="registration-form" method="POST" action="#">
in javascript:
let registrationForm = document.getElementById('registration-form');
registrationForm.on('submit', function(event) {
event.stopPropagation();
//... your business logic here
// submit the form, e.g. using jQuery's ajax() function
});
jQuery.ajax(): http://api.jquery.com/jQuery.ajax/
actionis executed which in your case isjavascript:void(0);- you sure that is what you want?action="javascript:void(0);"with the URL you wanted to submit the data to: Show us that. Why do you think you need to use JavaScript? Forms are designed to submit data with just HTML. Why do you think you need to add method="POST"?