1

i'm using leaflet to work with a map. I have a form and an

<input type="submit"...>

when i press the input-button the leaflet-map reloads and looses all layers. the map-div is not inside the form. how to prevent the map from reloading? tried

e.preventDefault and onsubmit="return false;"

any ideas?

kboul
  • 13,836
  • 5
  • 42
  • 53
JillE
  • 11
  • 1
  • If you don't need the submit functionality, use ` ` instead – peeebeee Oct 28 '19 at 14:38
  • I would advise to use ` – Egor Oct 28 '19 at 14:42
  • i need the submit functionality :( i'm sending data to vb code-behind on the server – JillE Oct 28 '19 at 14:42
  • You can send it without submit, for example https://stackoverflow.com/questions/35203019/how-can-i-send-an-ajax-request-on-button-click-from-a-form-with-2-buttons – Egor Oct 28 '19 at 14:45
  • A consequence of having a 'Submit' button is that the page will reload either with the same URL or the `target`. Suggest you investigate an Ajax-based solution which submits the form data and leaves the rest of the page in place. – peeebeee Oct 29 '19 at 08:39

1 Answers1

-1

You can try removing type="submit" attribute from your button if you don't need the submit functionality.

s4k1b
  • 2,955
  • 1
  • 7
  • 14