wordpress ajax call not working in firefox

I have followed the very good tutorial from Daniel Pataki to add AJAX calls to my WP site.

Everything works fine, except one specific AJAX call and only in Firefox.

I give below the details to reproduce the problem. It includes login credentials, but it is a WP test site and these are fake credentials, so don’t worry, you can use it.

Go to https://responsive.knowledgeplaces.com

Login with credentials “aweb01” as userid and password.

Once connected, you will see different buttons. These are buttons for testing purposes.

For instance, you can click on the button “no lpId parameter”, and you will see an error message.

This button triggers an AJAX call on the server, and an alert message is displayed if some validation went wrong on the server.

This button works fine and you will see the alert message on any browser.

There is another button “deconnexion” (logout) on the upper right side of the page.

When you click on this button, you are logged out from the site.

The button works fine on Chrome and IE, but not on Firefox.

Here is how it is implemented.

There is a javascript file with the following code:

$("a[href='/kps_logout']").on('click', function() {
// check href symbolic URL
'action': 'kps_logout',
'security': $("#kpcms-ajax-nonce").val()
// redirect and deactivate default navigation
window.location.href = $kps_Host + $kps_LoginPath;
return false;

basically, I use a symbolic ‘/kps_logout’ URL, and this JQuery code maps a logout function on any href with this link.

on the server, I have this:

add_action( 'wp_ajax_kps_logout', 'kps_logout' );
add_action( 'wp_ajax_nopriv_kps_logout', 'kps_logout' );
function kps_logout() {
// security check
check_ajax_referer( 'kpcms-ajax-nonce', 'security' );
// logout user and die
die ();

Once again, works perfectly in Chrome and IE, not if Firefox.

If I activate the network dev tools, it sounds the AJAX call is not even performed in Firefox, while I can see it in Chrome and IE.

On the “no lpId parameter” button, I can see the AJAX call in all browsers, and it works fine on all browsers. And it is implemented exactly the same way.

So if you can help me on this, it would be great!