I am not familiar with extjs, but in your example it appears that the success scenario is commented out. Also, should the "response" variable be "xhr.response"? "response" will evaluate to undefined in the function as you pasted it (unless it's a magic variable that is part of extjs?), and if it's a global variable declared elsewhere, it's probably not the response text from the AJAX call.
Otherwise it would definitely help to see the server-side code you're using for the file content. Best, Eric On Tue, Feb 22, 2011 at 2:40 AM, Sandeep Kulkarni <[email protected] > wrote: > Hi, > > Thanks but I have already tried this solution. I didn't get file downloaded > on client machine. > > I have following code at client side. Is any thing lacking there? I am > using AJAX here in extjs. > > > function downloadFile(){ > var url='/download_key'; > > var ajaxReq=ajaxRequest(url,0,"GET",true); > ajaxReq.request({ > success: function(xhr) { > //Ext.MessageBox.alert(_("Success"), response); > }, > failure: function(xhr){ > Ext.MessageBox.alert( _("Failure") , xhr.statusText); > } > }); > } > > > Regards, > Sandeep > > > > On Tue, 2011-02-22 at 13:28 +0530, Graham Higgins wrote: > > -----BEGIN PGP SIGNED MESSAGE-----Hash: SHA1 > Hi, > On 22 Feb 2011, at 07:01, Sandeep wrote: > > I have some text content in database field. I want to download that> text > > content from database field on client machine. > http://stackoverflow.com/questions/790019/how-do-i-return-a-csv-from-a-pylons-app > shows how to do this for a .csv file. > > I want this text content in a file at client side. > > This isn't really related to Pylons, you just need to set the relevantHTTP > response headers: > http://www.webmasterworld.com/forum88/12908.htm > > - --Cheers, > Graham > http://bel-epa.com/gjh/ > > > > > > > > -----BEGIN PGP SIGNATURE----- > iEYEARECAAYFAk1jbJAACgkQOsmLt1Nhivzv/gCfUEtz6r6GeIb+kM+5s9XsUx9E1nAAoNhiV5LKetd8RaUMd9mQZOxQExe3iQCVAgUBTWNskFnrWVZ7aXD1AQJcYQP9Ebu6uZNyQVpw9ZBB1M3i3laoaYrIN6vecg0DLV9h77Nzx+oGbQ/VntEG2If33j91jBgTScRn8ZTvfKagQUKW/kqjVNc3w9Kqo3e+iSPaV/zE3PmUPfSxJ9nhkTOgqbNHz18t54X8PeViAfMgvnhg9ntzWYGohW9tdNyHt/IxJ1U==+FQx-----END > PGP SIGNATURE----- > --You received this message because you are subscribed to the Google Groups > "pylons-discuss" group.To post to this group, send email to > [email protected] unsubscribe from this group, send email to > [email protected] more options, visit this > group at http://groups.google.com/group/pylons-discuss?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
