Q:

One submit button two event in Html

<button id="Submit" onclick= "write_task_content()"> Submit.</button>

I have this code written on my page for submit button. write_task_content() function is writing the activity of users into the file. I need to redirect to another page which is in another directory when same submit button being clicked. 
for example:
Current path C:\xampp\htdocs\CC_real task\3GBCJUK5B10I32J9O2EJNNQ339GPKH.html where Submit is written. where write_task_content() function needs to be executed to save user activity and with the same button redirect to another page in the same window browser C:\xampp\htdocs\IA_real task\3RKALKFQG14FDCEAT1S123EW94A792. 
How could I do that?

A:

First create your submit button:
<form action="destination-page.html">
<input type="Submit" value="Submit" />
</form>

Then, in the <script>...</script>, attach an onsubmit event to the form either using javascript or jquery:
Javascript:
var form = document.getElementsByTagName('form')[0];
form.addEventListener('submit',write_task_content,false);

jQuery:
$(document).ready(
    $('form').submit(write_task_content);
);

When the submit button is clicked, write_task_content() will execute first and then the browser will request destination-page.html. 

