File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Ajax invalid Jason response with current page HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Ajax invalid Jason response with current page HTML" Watch "Ajax invalid Jason response with current page HTML" New topic

Ajax invalid Jason response with current page HTML

Ragupathirajan Venkatesan
Ranch Hand

Joined: Aug 18, 2010
Posts: 62
Dear All,

In my ajax call, i am getting the Jason response. Unfortunately I am getting the additional content of HTML along with the response. That HTML is equivalent to page from where I am triggering the Ajax request. It is java struts web application, in the action class before addding the content to printwriter object i am printing the response, which has only the required response. But in jsp while retriving through responseText ,, some HTML content is getting added to the original required response. By the use of alert I came to know that it is the HTML source of current page.

If any of you came across this kind of issue, please advice me. Thanks in advance.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62761

By the way, it's JSON, not "Jason".

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1416
So your action is completely handling the response?

What does your action code look like?
What (if anything) are you returning from it?
What version of struts are you using? 1.1? 1.2? 2.0?

For Struts1.2, make sure that you return null from your execute method to inform Struts that you have handled the response, and it doesn't need to.

I agree. Here's the link:
subject: Ajax invalid Jason response with current page HTML