Wicket.Ajax.Call.failure: Error while parsing response: Object required

旧巷老猫 提交于 2019-12-23 17:30:03

问题


I just spent several hours of my life debugging this problem. I'm documenting it here for others.

Question:

I'm getting the following error when I try to click on an AjaxLink in Internet Explorer:

Wicket: ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Object required

It works fine in all other browsers; just IE is busted.


回答1:


Check to make sure that your HTML is 100% syntactically correct. Ajax responses are returned to the browser inside a CDATA section, and if the payload is not well-formed, IE will sometimes choke.

In my case I neglected to close a <link> tag in the <head> section. Simply closing that link tag made all the difference.

Aside: if you ever come across a tough-to-solve problem in Wicket, it's a good idea to create a quickstart project that reproduces your issue. It can be a lot of work to boil things down, but in doing so you often find the source of the problem.




回答2:


I want to note one more potential reason for the issue with Wicket's AJAX in IE. It might help someone, who encounters similar problem.

In my case I had the following error message in IE:

Wicket: ERROR: Wicket.Ajax.Call.failure: Error while parsing response: could not find root <ajax-response> element

The reason was an incorrect Content-Type of AJAX response. I used AbstractTransformerBehavior and there was a bug in Wicket 1.4.x so this behavior was rewriting response Content-Type with text/html. IE does not parse such response as XML.



来源:https://stackoverflow.com/questions/6207309/wicket-ajax-call-failure-error-while-parsing-response-object-required

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!