Support » Plugin: Loco Translate » Error: SyntaxError: Unexpected token

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author timwhitlock


    Your error sounds like the Ajax services is returning HTML instead of JSON. Usually this is due to an unrecoverable PHP error. We need to find out what that error says. You can do that either by looking in your error logs, or inspecting the Ajax request in your browser dev tools.

    If you can tell me what the error says, I might be able to help.

    In answer to your second question – updating the plugin will probably overwrite all existing files including PO and MO files.

    If the plugin update adds new translatable strings, those changes should be reflected in the plugin’s own POT file if it has one.

    I’d recommend backing up the PO files you’ve modified and putting them back after the update. Then opening each one in the Loco editor, running the “sync” operation and then saving again if all is well.

    Hello. Hopefully this will help. This is the error I got when trying to save a translation

    Plugin Author timwhitlock


    Nearly there.
    If you select that item and hit the Preview tab, you will see the rendered HTML for the error, this will probably contain the words describing the PHP error.

    Sorry about that… for some reason I can’t replicate the error within my console… is there someway to send you my login details so you would possibly be able to look at the error yourself? Whenever I click save and the error pops up, no error is popping up in the console.


    Plugin Author timwhitlock


    I don’t follow what you mean about not being able to replicate the error.
    I can see from your screenshot that the error is there to be viewed. Are you saying it’s no longer happening?

    I’m afraid so. Whenever I try to save a translation, I’m still getting the same error
    Error: SyntaxError: Unexpected token <

    However, nothing shows up in the console like it did before in my previous screenshot.

    Plugin Author timwhitlock


    It’s possible the response is cached if it’s not showing up.
    Clear your browser cache and try again.

    Hi there. Thanks for all of your help. I cleared my cache and tried again and unfortunately no error. I did try in firefox but got a completely different error
    Error: SyntaxError: JSON.parse: unexpected character

    Not sure if that helps at all?

    Hi there,

    Would really love to use your plugin as it’s the only one on the market that looks like it will work for me… just need to get passed this small hiccup.

    Is it possible for me to give you login details to my site for you to take a look at the error?

    I also went into my files via ftp and pulled up the php error log and I have no errors in the log referring to your plugin. Could this be a plugin conflict of some sort?

    Plugin Author timwhitlock


    please email details to support at localise dot biz.

    Just reporting back.. this was infact an issue with my hosting company… not an issue with the plugin. Works great now thanks for the awesome plugin!

    Hi, im having the same issue, we just moved Host.

    What was the solution to this?

    Plugin Author timwhitlock


    There is nothing to say your problem is the same. This will occur if any Ajax request responds with something other than valid JSON. Please open a new ticket with the output of the offending Ajax request, plus any errors in your log files.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Error: SyntaxError: Unexpected token’ is closed to new replies.