i am making a request to the server with xmlhttprequest.
The server returns some text.
I need to store that responseText in a file. Is it possible to store the response in a file?
Do not use an XMLHttpRequest Object, send data to an iframe instead. Have the page set the correct headers to force a file download.
Eric
yuvaraj KumarAmudhan
Ranch Hand
Joined: Aug 22, 2009
Posts: 110
posted
0
thank you sir!
is there anyway to pass the "css file" from the server to the client?
I need to fetch the "css file" from the database and that should be returned to the client.
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
0
css file? you letting them download that?
You need to set these headers on the page:
Set a hidden iframe's url to the page you want to download.
Eric
yuvaraj KumarAmudhan
Ranch Hand
Joined: Aug 22, 2009
Posts: 110
posted
0
thank you Eric sir!
Actually, I am making the request to the server via Ajax to get some css content.
The server replies the css content in "text" format.
i have to link that "css String" to the Html page like,
(<link rel="stylesheet" type="text/css" href="That Css String response" >.
I don't know how to achieve this.
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
0
Than you do not want to download it.
There i no need to make an Ajax request, just set the href of the link tag to the place your Ajax call is being made to
/Template Viewer/GetFile ---> This links the servlet and servlet calls a method in DAO layer.
That method gets the "css content as String" (String! not a css file) from the database and return that string to the servlet.
Finally 'the css content comes as String" in servlet.
'href' attribute of 'link' tag links only the css file i think(Not the string).
still confused!
thank you!
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
0
Set the content type of text/css of the string being returned. It does not care how the CSS file is generated on the server.