java script function disappear after clicking on submit button
Solution 1:
Your GetNewMap
method does not prevent the default action. You display a new map, and then the form is submitted to the server, and your new map will disappear.
You need to prevent the form from being submitted:
<form method="get" name="mynewMap" onsubmit="GetNewMap(event)">
function GetNewMap(e) {
e.preventDefault();
...
Event.preventDefault() - Web APIs | MDN
As pointed out in the comments, the alternative is to change your <button type="submit"
to a <button type="button"
, which would not submit the form. In that case, you would need to handle the button's click
event rather than the form's submit
event.