Because onsubmit event not working with “input” tag.
You can see more details in https://www.w3schools.com/jsref/event_onsubmit.asp
Supported HTML tags: form, keygen
Replace code to
<form method="post" onSubmit="window.location.reload()">
<input type="submit" name="switchlon" id="switchlon" value="Switch to London" /><br/>
</form>
or
<form method="post" >
<input type="submit" name="switchlon" id="switchlon" onClick="window.location.reload()" value="Switch to London" /><br/>
</form>
Related Posts:
- element not working in Safari [closed]
- Cannot access $wpdb, comes back NULL
- Send an e-mail on address with the link with disliked post
- JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error
- WordPress Infinite Scroll without using any plugin
- Create Image Uploader for Widget
- WordPress Ajax always returns a 404 error
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- WordPress customizer: load controls in a custom div
- Ajax template: how to handle head section
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- How to resize image on client-side before upload?
- Limit the Excerpt field in WP-Admin in words
- Run shortcode at certain resolution
- Passing PHP Variables to JS using Localize Script
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Customizer Show/Hide Logo and Site Title
- Understanding WordPress child theme custom JS loading
- Use different javascript files for each page on website
- Create custom blocks for bootstrap
- Click loads template via ajax
- javaScript in section of WP API
- Sending jsPDF documents to the server
- How can I add an alert (like the old javascript alerts) to my WP page?
- js file in root loading without
- Adding custom directory and PHP files in wordpress
- Populate dropdown with Child Pages based on Parent Page chosen
- JS file work only in index page
- How to change redirection route to a php page for making it only accessible by logged-in members?
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- Save Search System
- dynamic dependent select dropdown
- Ajax load more button for comments wordpress
- How to pre populate a form field with a link of a current user’s author profile?
- parts of url disappear when using # inside href=”” [closed]
- Why my image upload button is not working in wordpress widget area?
- How does wp_enqueue_scripts work?
- WordPress Scripts Being Loaded in Footer
- How do I Import / Upload Files with jQuery AJAX?
- Noscript not working as it should in wordpress site
- PHP echo inside javascript
- How to add API security keys into JS of wordpress securely
- AJAX button action in foreach
- Add Codepen animation as Preloader to WordPress
- HTML escaping data with ajax requests
- Function won’t run onclick using Ajax
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- How to use wordpress function wp_enqueue_script() in php?
- Get related product based on subcategory selected from category id with ID 142
- wp_nav_menu not working correctly in my underscores theme
- url_to_postid returns 0
- How do i add slugs to a URL, but still redirecting to the same page
- Link to page with posts of specific type
- implementing a jQuery “click to expand” link in WordPress [closed]
- random reason on refresh
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- Some problems in custom widget
- Call a function in functions.php from within tags (JS)
- Hook on file upload
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- WordPress Search Ajax + Isotope + InfiniteScroll
- WordPress User Meta value variable into Google Gauge Chart
- duplicate posts with ajax load more wordpress
- How to extend SelectControl with data from my theme
- Show next image in array if page is revisited by same logged user
- How to call my PHP function with AJAX ? wp_query
- Fetch Data from an external MSSQL Database in a Managed WP hosting
- Using Google Analytics in an enqueued JS file
- Create a WordPress Contact Form to call a POST AWS API Gateway and send user data
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- separate list of programs in html/javascript coming from php
- How do I disable cache for a certain page?
- How To Get HTML Eelement From Another Page
- Conditional Banners
- Update $wpdb query with AJAX
- $.ajax results in 403 forbidden
- AJAX to add to cart multiple products woocommerce
- Filter portforlio with librairie isotop
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- admin-ajax.php 400 bad request – whats wrong with my code?
- Serve cookie free URLs in WordPress without using a CDN
- Target a specific container to style on WordPress storefront theme
- Force ‘permanent’ post cache of shortcode results
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- How to create a radio button to alt between settings in wp_options table
- customizer live preview layout picker
- I need help implement a Javascript code into the PHP file
- Admin bar nodes
- How can I correctly POST to a WordPress page?
- if is_home(), change class of menu-item-225 of wp_nav_menu
- Load php function with AJAX on modal window
- JSON Object Value Show Undefine
- Require Credits Footer
- Adding jquery using php function
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- notify users when changed database
- bloginfo url in javascript