After defining my javascript array as var seatsArray = []; with some contents, I'm looking to save the contents of that array to a .txt file on the server upon the user clicking a button. The text file does not exist yet, so it needs to be created.
Additionally, I am wondering if there is a way for the user to input the name of the text file they want to create by typing it into a text area. Any suggestions on how this can be achieved?
Do you have any ideas or solutions for this scenario?
Thank you, John
EDIT:
I've added the recommended code but nothing seems to happen when I hit save?
<form id="my_form" action="">
<input type="text" id="file_name" rows="1" cols="20">
<a href="javascript: SubmitForm()">Save</a>
</form>
<script type="text/javascript">
function submitform();
{
var d = seatsArray.join();
var url = "/txtfiles/"+d + "&file_name=" +
document.getElementById("file_name").value;
document.getElementById("my_form").action = url;
document.getElementById("my_form").method = "POST";
document.getElementById("my_form").submit();
}
</script>
This code block should be placed within the body section of your HTML document.
Thanks