Location.reload redirects to the response php and <a> reloads the page

  contact-form, html, javascript, php

DISCLAIMER: My project is quite an hefty one. I tried to snippet here it really doesn’t work.

Main files

Index: https://www.postaxi.it/mapsv2/index.php (if you want you can’t test it here)

JS: https://www.postaxi.it/mapsv2/assets/js/main.js

CSS: https://www.postaxi.it/mapsv2/assets/css/main_g.css

Hi,
So an unusual question. I’m building a courier price calculator with Google Maps API. Everything works, but i have two strange bugs:

  1. (Line 160 in index.php) After an error, i have a button with onclick="location.reload();" because it’s early in the process it feels better to just restart all the procedure. But this reload works almost like a submit, redirecting to the .php file (../ptgfsuc.php) that handles the mail sending after the submit.

To replicate this error, put in the input "Indirizzo partenza" -> "via vincenzo monti 1 milano" and in "Indirizzo arrivo" -> "via pomponazzi 6 milano" and click "Calcola percorso". In the next slide, just fill the four inputs and click "Avanti". You’ll have the slide with error on the button "Ricarica ricerca".

  1. (Line 283 in index.php) At the end i have a privacy check with an external link using and target="_blank". Instead of opening the other tab to the link, it opens a new tab to my page.

To replicate this error, put in the input "Indirizzo partenza" -> "via corsica 1 milano" and in "Indirizzo arrivo" -> "corso magenta 6 milano" and click "Calcola percorso". In the next slide, just fill the four inputs and click "Avanti". In the next slide, just select one option in the radio input and click "Avanti". In the next slide you’ll find the on "Regolamento EU…."

I really do not understand why this happens. Can you help me somehow? Thanks

Source: Ask Javascript Questions

LEAVE A COMMENT