Problem AJAX(ing) JSON object on Mac Firefox version (3.6.12)

后端 未结 2 1157
长发绾君心
长发绾君心 2021-01-19 12:41

Let\'s say I want to call some server method and pass it the following JSON object:

var t = { \"test\": 0};

I\'m using jQuery library $.aja

2条回答
  •  长情又很酷
    2021-01-19 13:25

    I think this is a duplicate of JQuery AJAX Error in Firefox on Mac with "Managed" Users

    The problem is a conflict between Firefox and the parental controls in Mac OS X 10.5. The last two characters of the POST data are replaced with Pr. The problem was first reported two years ago, and it doesn't look like it will be fixed.

    The best work around I am aware of is to use SSL because that seems to prevent the problem. If that isn't an option, then you need to add at least 2 characters to the end of your POST data which can be ignored. In a form that would mean adding something like to the end of the form (credit to Miquel Botanch). For JSON/XML requests, the last few characters are important for parsing. If you can't just add spaces or new lines (maybe that would work, I haven't tried), then you need to add some other dummy value client side. Finally, server side you'd need to detect and remove this extra dummy value (as krul's answer does).

提交回复
热议问题