I have a bug with an Ajax request but it works on Firefox. You can test it clicking here

For Edge/Chrome I got a 400 error.

In Edge I got this error :

HTTP400: INCORRECT REQUEST - the request could not be processed by the server due to invalid syntax.

What could be the problem in my request ?

Request : https://www.passerellepouremploi.com/wp-admin/admin-ajax.php?action=getH4ACustomPostTypeByAjax&data%5Bh4a-list-post-status%5D=false&data%5Bh4a-list-view-mode%5D=card&data%5Bh4a-list-post-type%5D=formation&data%5Bh4a-list-spec-cat%5D=false&data%5Bh4a-list-cat%5D=false&data%5Bh4a-list-order%5D=false&data%5Bh4a-list-orderby%5D=false&data%5Bh4a-list-meta-key%5D=false&data%5Bh4a-posts-per-page%5D=false&data%5Bh4a-list-pagination%5D=false&is_count=true

Why it works for Firefox but not for others browsers ?

  • 2
    I'm getting the error in Safari, Chrome and Firefox, so I don't think it's a browser issue. Question; are you logged into WP with one browser but not the other? – Tony Djukic Apr 18 at 0:54
  • @TonyDjukic Sorry, I did a test. It works for all browsers but only when you are logged in. So thanks for your notice which could help me a lot. I was logged in on Firefox, not for Chrome ;) – J.BizMai Apr 20 at 12:27
  • Fantastic. There’s two different actions for AJAX execution, one for everyone and another for logged in users only. – Tony Djukic Apr 20 at 14:26
  • 1
    Yes, I know my problem was fixed.wp_ajax_nopriv was wrapped by is_admin(). That could not work ^^. Thanks a lot ! – J.BizMai Apr 20 at 14:33

Problem fixed ! The problem was not due to a browser matter. wp_ajax_nopriv_myfunction was wrapped by is_admin(). That could not work. I was logged in in Firefox and not in Chrome that´s why I thought it was a browser matter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.