0

How can i make a save file as option in Ajax response?
This response returns files in 3 different formats.
I have to ask User to save file as in thet format.
(Hope i have to open some Save file prompt)
Can anybody tell me?
Thanks

Edited by nithyavelumani: n/a

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by Airshow
0

Quetions:
Where do you want the file to be saved?
Why not ask the user to choose from the 3 formats before sending the request?

Airshow

0

Quetions:
Where do you want the file to be saved?
Why not ask the user to choose from the 3 formats before sending the request?

Airshow

Thank U.:)
Well user selected the format of file in frontend , then using ajax, i will send request to back end, then from backend , getting that file in user selected format, (line by line).
Instead of tiz, i have to ask user to choose a place for file to save.
For example if one csv file having content of RED,GREEN,BLUE .. i have to ask user to save file as instead of giving that whole line. Now i get response as whole line(RED,GREEN,BLUE)

Edited by nithyavelumani: n/a

0

OK, but you still haven't told me - where do you want the file to be saved - client or server?

Airshow

0

OK, but you still haven't told me - where do you want the file to be saved - client or server?

Airshow

Have To Store in client location . They only select location.

0

OK, but you still haven't told me - where do you want the file to be saved - client or server?

Airshow

Have To Store in client location. They only select location.
(save as prompt have to open)

0

Nithyavelumani,

Browser limitations mean that you can't save data returned as an AJAX response, as a client-side file.

You are forced into returning a file in response to a regular HTTP request. When the file is returned in the right way (correct MIME type set) the browser will display a standard save dialog. In all modern browsers, the web page will remain intact, so there's little difference in practise between this approach and AJAX.

However, you can only return one file, not three. Hence you need to arrange for the user to select one of the three available file types before the request is sent, then compose the request URL accordingly (eg. append the query string ?type=csv ). Your server-side script will need to read type and compose the file accordingly.

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.