I have a form that I submit to the django server by calling.
$("#my_form").submit();
The server returns the xml file by executing this code:
content = some_data_retrieved_from_database_as_xml() response = HttpResponse(content, content_type='text/xml') response['Content-Disposition'] = 'attachment; ' response['Content-Disposition'] += 'filename=my_file.xml' response['Content-Encoding'] = 'UTF-8' return response
Google Chrome only downloads this file, but I need an extra callback function called myFunction (data).
Chrome should load this file and the next call to myFunction (this xml file).
I tried this code but it does not work:
$("#my_form").bind('ajax:complete', myFunction);
I also tried using $ .post, but after that only the callback function is called and, unfortunately, my file is NOT uploaded.
javascript jquery file django download
domandinho
source share