Loco Error: Ajax failure for save
-
I’m seeing in JS console: “Loco Error: Ajax failure for save”, when I try to modify theme translation (I’m changing Avada theme).
I saw in this thread https://www.ads-software.com/support/topic/i-can-not-save-my-translations/ that you are advising to download dev version 2.0.15 which I did, but that didn’t resolve problem for me.I was doing some changes on woocommerce plugin and that worked just perfectly
Any help with this would be great
-
Please provide the information required to identify the cause of Ajax failures:
https://localise.biz/wordpress/plugin/faqs/debug-info#ajaxI see two calls to admin-ajax.php. 1st one is 404, and second one 200. Which I don’t really understand why.When I start new translation I see that po and mo files are created, but after I change something and hit save I see that ajax error
===== call #1 ====
Request URL:https://somedomain.com/wp-admin/admin-ajax.php Request Method:POST Status Code:404 Not Found Remote Address:10.10.10.10:443 Referrer Policy:no-referrer-when-downgrade Response Headers view source Cache-Control:no-cache, must-revalidate, max-age=0 Connection:Keep-Alive Content-Encoding:gzip Content-Length:12634 Content-Type:text/html; charset=UTF-8 Date:Tue, 12 Sep 2017 15:57:21 GMT Expires:Wed, 11 Jan 1984 05:00:00 GMT Keep-Alive:timeout=3, max=200 Link:<https://somedomain.com/wp-json/>; rel="https://api.w.org/" Server:Apache Set-Cookie:woocommerce_cart_hash=84a34d860d325c7b21a21d56135d5789; path=/ Set-Cookie:wp_woocommerce_session_e3f8ba232968eac5713ed52240400abd=1%7C%7C1505404572%7C%7C1505400972%7C%7C59ad854cefe286de5ec8000198495a39; expires=Thu, 14-Sep-2017 15:56:12 GMT; Max-Age=172729; path=/ Set-Cookie:wp_woocommerce_session_e3f8ba232968eac5713ed52240400abd=1%7C%7C1505404572%7C%7C1505400972%7C%7C59ad854cefe286de5ec8000198495a39; expires=Thu, 14-Sep-2017 15:56:12 GMT; Max-Age=172729; path=/ Set-Cookie:woocommerce_items_in_cart=1; path=/ Set-Cookie:woocommerce_items_in_cart=1; path=/ Set-Cookie:woocommerce_cart_hash=84a34d860d325c7b21a21d56135d5789; path=/ Vary:Accept-Encoding X-Powered-By:PHP/7.1.9 Request Headers view source Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip, deflate, br Accept-Language:en-US,en;q=0.8,hr;q=0.6,sr;q=0.4,cs;q=0.2,bs;q=0.2 Connection:keep-alive Content-Length:498075 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Cookie:wordpress_sec_e3f8ba232968eac5713ed52240400abd=master%7C1506441364%7CfeHv5Q0OYlDL6K1JLxXzFFqY3Lk43i3quRR2tIqdF2t%7C51250bbbd42b8d3711eb10a9fe73342f2ee172cabd41e563d6d2e33b235ace39; _ga=GA1.2.1707964198.1505231745; _gid=GA1.2.290644932.1505231745; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_e3f8ba232968eac5713ed52240400abd=master%7C1506441364%7CfeHv5Q0OYlDL6K1JLxXzFFqY3Lk43i3quRR2tIqdF2t%7C0afb2398b7548c6a8881070c8bb42cba6348442f4b2164c55fdd009f0818a62b; wp-settings-1=libraryContent%3Dbrowse%26editor%3Dhtml; wp-settings-time-1=1505231767; woocommerce_items_in_cart=1; woocommerce_cart_hash=84a34d860d325c7b21a21d56135d5789; wp_woocommerce_session_e3f8ba232968eac5713ed52240400abd=1%7C%7C1505404572%7C%7C1505400972%7C%7C59ad854cefe286de5ec8000198495a39 DNT:1 Host:somedomain.com Origin:https://somedomain.com Referer:https://somedomain.com/wp-admin/admin.php?path=languages%2Floco%2Fthemes%2FAvada-en_US.po&bundle=Avada&domain=Avada&page=loco-theme&action=file-edit User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 X-Requested-With:XMLHttpRequest Form Data view source view URL encoded action:loco_json route:save loco-nonce:5e4f41c6e1 path:languages/loco/themes/Avada-en_US.po bundle:theme.Avada domain:Avada locale:en-US data:msgid "" msgstr "" "Project-Id-Version: Avada 5.2.2\n" "Report-Msgid-Bugs-To: https://www.ads-software.com/support/theme/style\n" "POT-Creation-Date: 2017-08-07 17:24:10+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "PO-Revision-Date: 2017-09-12 15:57+0000\n" "Last-Translator: master <[email protected]>\n" "Language-Team: English (United States)\n" "X-Generator: Loco - https://localise.biz/\n" "Language: en-US\n" "Plural-Forms: nplurals=2; plural=n != 1"
======call 2======
Request URL:https://somedomain.com/wp-admin/admin-ajax.php Request Method:POST Status Code:200 OK Remote Address:10.10.10.10:443 Referrer Policy:no-referrer-when-downgrade Response Headers view source Access-Control-Allow-Credentials:true Access-Control-Allow-Origin:https://somedomain.com Cache-Control:no-cache, must-revalidate, max-age=0 Connection:Keep-Alive Content-Type:application/json; charset=UTF-8 Date:Tue, 12 Sep 2017 15:57:40 GMT Expires:Wed, 11 Jan 1984 05:00:00 GMT Keep-Alive:timeout=3, max=200 Server:Apache Set-Cookie:woocommerce_cart_hash=84a34d860d325c7b21a21d56135d5789; path=/ Set-Cookie:wp_woocommerce_session_e3f8ba232968eac5713ed52240400abd=1%7C%7C1505404572%7C%7C1505400972%7C%7C59ad854cefe286de5ec8000198495a39; expires=Thu, 14-Sep-2017 15:56:12 GMT; Max-Age=172711; path=/ Set-Cookie:woocommerce_items_in_cart=1; path=/ Transfer-Encoding:chunked X-Content-Type-Options:nosniff X-Frame-Options:SAMEORIGIN X-Powered-By:PHP/7.1.9 X-Robots-Tag:noindex Request Headers view source Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip, deflate, br Accept-Language:en-US,en;q=0.8,hr;q=0.6,sr;q=0.4,cs;q=0.2,bs;q=0.2 Connection:keep-alive Content-Length:103 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Cookie:wordpress_sec_e3f8ba232968eac5713ed52240400abd=master%7C1506441364%7CfeHv5Q0OYlDL6K1JLxXzFFqY3Lk43i3quRR2tIqdF2t%7C51250bbbd42b8d3711eb10a9fe73342f2ee172cabd41e563d6d2e33b235ace39; _ga=GA1.2.1707964198.1505231745; _gid=GA1.2.290644932.1505231745; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_e3f8ba232968eac5713ed52240400abd=master%7C1506441364%7CfeHv5Q0OYlDL6K1JLxXzFFqY3Lk43i3quRR2tIqdF2t%7C0afb2398b7548c6a8881070c8bb42cba6348442f4b2164c55fdd009f0818a62b; wp-settings-1=libraryContent%3Dbrowse%26editor%3Dhtml; wp-settings-time-1=1505231767; woocommerce_items_in_cart=1; woocommerce_cart_hash=84a34d860d325c7b21a21d56135d5789; wp_woocommerce_session_e3f8ba232968eac5713ed52240400abd=1%7C%7C1505404572%7C%7C1505400972%7C%7C59ad854cefe286de5ec8000198495a39 DNT:1 Host:somedomain.com Origin:https://somedomain.com Referer:https://somedomain.com/wp-admin/admin.php?path=languages%2Floco%2Fthemes%2FAvada-en_US.po&bundle=Avada&domain=Avada&page=loco-theme&action=file-edit User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 X-Requested-With:XMLHttpRequest Form Data view source view URL encoded interval:60 _nonce:6dfbcfdcba action:heartbeat screen_id:loco-translate_page_loco-theme has_focus:false Name admin-ajax.php admin-ajax.php ?http_envelope=1&fields=id%2Ctype%2Cunread%2Cbody%2Csubject%2Ctimestamp%2Cmeta%2Cnote_hash&number=10
The first call is the one. The second is WordPress.
As per the link I posted, I need to see the response, not the request. This may show what is throwing a 404. It’s unlikely to be coming from Loco Translate, because the plugin won’t fail this way if there’s a problem.
As a side note the request you’ve posted is truncated. Did you do that deliberately?
Yes I cut it on purpose it was just dictionary data.
Here is the response:
[snipped large block of code – please use Pastebin or Gist in the future]
-
This reply was modified 7 years, 6 months ago by
stephencottontail.
-
This reply was modified 7 years, 6 months ago by
stephencottontail. Reason: snipped large block of code
Also this is what is dumped in console, when i hit Save button
[snipped large block of code – please use Pastebin or Gist in the future]
-
This reply was modified 7 years, 6 months ago by
stephencottontail. Reason: snipped large block of code
Looks like the moderators have removed your post contents.
Regardless, I can see that the response is a HTML not found page. My plugin would not create such a response from an Ajax request. It will always return JSON unless something external is stopping it from working. I cannot guess at what that is in your case.
Yes looks like my posts were removed. To answer your first question, yes i truncated that because it was just raw data. So here is the console dump on gist
I disabled all plugins except Loco Translate
https://gist.github.com/struxoje/e7b4a589875662cabeae604367e4b6f3I will send full response in a min
Here it is the response.It is as you said just 404 page. However, I have this problem only if I try to edit theme, however, if i do the same with plugins everything works perfectly. This is new installation, so there is nothing fancy in there and plugins are disabled
https://gist.github.com/struxoje/b3fa041aa3fa347cb0c11dc49af3646a
Btw in previous console dump there was
Provide the following text when reporting a problem:
–8<–In case that means something to you
Thank you!
With debugging enabled I see in console:
Provide the following text when reporting a problem:
–8<–
(2)
“Notice: Trying to get property of non-object in /home/site/www/wp-includes/class-wp-query.php on line 3760Notice: Trying to get property of non-object in /home/site/www/wp-includes/class-wp-query.php on line 3762
Notice: Trying to get property of non-object in /home/site/www/wp-includes/class-wp-query.php on line 3764
These notices are not related to Loco Translate. I can’t say if they’re related to your 404. My guess would be not.
Your dumps confirm what we already know. Something is throwing a 404 at the admin-ajax.php end point. This should never result in a 404, and Loco Translate will never throw one.
My plugin relies on WordPress’s Ajax hooks to work properly. Something seems to be stopping them from working and I have no clue as to what it could be. The exact same issue has been reported dozens of times and I’ve never been able to reproduce the issue.
Ok thank you. Bad luck I guess :/ It’s strange as it’s clean install… I’ll try to put few outputs in admin-ajax.php, and see if i can get anywhere
And… I have a SOLUTION!
Finally ?? So, long story short it looks like mod_security is causing problems with some of the ajax calls, my hosting provider is namecheap, and they have mod_sec on by default, I tried to disable it via .htaccess editing but that didn’t help. Only way how to handle this was to contact support, they have been able to confirm that mod_sec rules have been triggered, and they whitelisted problematic rules. That solved the problem. I hope this will be helpful to other people who see similar issue. I would also like to thank you for help with this which helped me pin point the problem. Perhaps config option would be not to use ajax, in case people are facing problems.
Good news, thanks for posting back.
It would be useful if you could post the offending rules that caused the problem. That way I could at least add some kind of test / diagnostics screen to help people in future.
Disabling Ajax is an option I’d rather not go down. It’s a perfectly valid and common use of WordPress. However, I can see the value in reducing support time. I will look into how difficult it will be.
Unfortunately they didn’t give me any specifics on what problematic rules were ??
Unfortunately, this has happened to me as well, so it does not save po and mo files.
This is the Loco translate messege when i save it:
Error: Page not found | Fül?pgumi. Check console output for debugging informationHere is the console
Loco Error: Ajax failure for save
admin.js:95:489
{…}
error: “error”
message: “Not Found”
output: “<!DOCTYPE html>\r\n<html lang=\”hu\” prefix=\”og: https://ogp.me/ns#\”>\r\n<head>\r\n<meta charset=\”UTF-8\”>\r\n<meta name=\”viewport\” content=\”width=device-width, initial-scale=1\”>\r\n<link rel=\”profile\” href=\”//gmpg.org/xfn/11\”>\r\n<link rel=\”pingback\” href=\”//fulopgumi.hu/xmlrpc.php\”>\r\n\t<link rel=\”shortcut icon\” href=\”//fulopgumi.hu/wp-content/uploads/2018/03/FULOP-Gumi-logo-F.png\” />\r\n\r\n\r\n<title>Page not found | Fül?pgumi</title>\n\n\n<meta name=\”robots\” content=\”noindex,follow\”/>\n<meta property=\”og:locale\” content=\”hu_HU\” />\n<meta property=\”og:type\” content=\”object\” />\n<meta property=\”og:title\” content=\”Page not found | Fül?pgumi\” />\n<meta property=\”og:site_name\” content=\”Fül?pgumi\” />\n<meta name=\”twitter:card\” content=\”summary\” />\n<meta name=\”twitter:title\” content=\”Page not found | Fül?pgumi\” />\n<script type=’application/ld+json’>{\”@context\”:\”https:\\/\\/schema.org\”,\”@type\”:\”Person\”,\”url\”:\”https:\\/\\/fulopgumi.hu\\/\”,\”sameAs\”:[],\”@id\”:\”#person\”,\”name\”:\”K\\u00e1d\\u00e1r L\\u00e1szl\\u00f3\”}</script>\n\n\n<link …”
status: 404
__proto__: Object { … } ………Provide the following text when reporting a problem:
—-
Status 404 “Not Found” (text/html; charset=UTF-8 27052 bytes)
Page not found | Fül?pgumi
{“@context”:”https:\/\/schema.org”,”@type”:”Person”,”url”:”https:\/\/fulopgumi.hu\/”,”sameAs”:[],”@id”:”#person”,”name”:”K\u00e1d\u00e1r L\u00e1szl\u00f3″} .services-area { background-color: !important; }
.services-area .widget-title { color: ; }
.services-area .widget-title:after { border-color: ; }
.service-icon { background-color: ; } .service-title,
.service-title a { color: ; } .service-desc { color: ; }
.employees-area { background-color: !important; }
.employees-area .widget-title { color: ; } .employees-area .widget-title:after { border-color: ; } .employee-name { color: ; }
.employee-position, .employee-social a { color: ; }
.employee-desc { color: ; }
.testimonials-area { background-color: !important; }
.testimonials-area .widget-title { color: ; }
.testimonials-area .widget-title:after { border-color: ; }
.client-function { col…-
This reply was modified 7 years ago by
kadarlaci.
-
This reply was modified 7 years, 6 months ago by
- The topic ‘Loco Error: Ajax failure for save’ is closed to new replies.