I would like my view to return the page content and some parameters that I
would like to use in the Ext.Ajax.request success function.
views.py
def importFile(request):
form = ImportVectorForm()
html_response = render_to_response("page_content.html", {'form':
form, 'folder':folder,
'nodes':nodes},context_instance=RequestContext(request))
if request.POST:
form = ImportVectorForm(request.POST, request.FILES)
if form.is_valid():
## here im dealing with the form...
object = MyObject.objects.create()
html_response = render_to_response("page_content.html",
{'form': form},context_instance=RequestContext(request))
json_param = serializers.serialize('json', object)
return StreamingHttpResponse(html_response,
content_type="plain/text")
else:
html_response = render_to_response("page_content.html",
{'form': form},context_instance=RequestContext(request))
return StreamingHttpResponse(html_response,
content_type="plain/text")
ajax.js:
importFileAjax = function(node_id){
Ext.Ajax.request({
method: "GET",
form: "importForm",
url: "/basqui/file/import/" + node_id + "/",
success: function(r){
// here I would like to access the model instance
created properties
Ext.get('table').update(r.responseText); //this
update the page content
}
});
}
I would like to pass both html_response and json_param to Ajax. The fist to
update a div and the second to access its properties.
What is the right way of doing that?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/169c4a0d-b314-4891-b5f6-17ddc1fea4b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.