Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Ajax post request content problem

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem with the ajax post request.

I have a form. Initially when the form page is loaded. Based on the search criteria iam going to
make a ajax post request. In this case the post request 'Content-Type' is correct(application/x-www-form-urlencoded). The post request goes to
the ActionServlet and then iam populating the GRID with the response.

I have a export option in the grid which will export the grid data to a XL sheet through a normal HTTPServlet but not ActionServlet. When i do this
export and try to change the search criteria and submit the request (next search criteria), now this time the request Content-type is changed to 'plain/text'.

I am not sure why after exporting grid data to XL, the next ajax request header information
is changing specially the 'Content-type' so the posted Data is not visible at server. I think it is taking the previous (export) request header information.

So due to this the subsequent ajax post requests are failing as the post data in the request header is not interpreted at the server.

I tried to clear the cache at the server using the below statements, but it doesn't work.

response.setHeader("Cache-Control","no-cache");

Please help me, thanks in advance for your time.

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you used a tool such as Fiddler to see what is being sent up to the server [Data and headers]?

Eric
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Venkat Gm", please check your private messages for an important administrative matter.

Also, do not post in all uppercase. I have adjusted the topic title for you. Please read this for more information.
 
Venkata Sirish
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric for reverting, yes i have used fiddler, the thing is request content-type is getting changed to text/plain, not sure why? eventhough iam making as POST ajax request.
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic