Monday, July 23, 2012

How To Display Non-Modal Popup From Resulting Asynchronous Javascript Request

I have a django application already developed which I'm trying to use to experiment with asynchronous javascript without using any of the standard JQuery type libraries, in order to better learn and understand AJAX concepts. The application itself has been written using python 2.7.1 and django 1.2.4. My view just returns the "request.responseText" from the asynchronous javascript call returns text only from a django view (via "return HttpResponse(message)"). I would try to use the "render_to_response()" shortcut function, but then it doesn't seem like the javascript callback function would be needed or used, so I hesitate to do so. I would like to display the returned text data on a new non-modal popup screen (using window.open()) so that the user can view it, while still interacting with the main screen, from which the asynchronous javascript call was originally issued. However when I initiate the asynchronous call and the popup is displayed I'm getting a 404, because apparently the url that I'm supplying for the popup is in error in some way. The 404 verbage returned in the popup looks like this:


Page not found (404)

Request Method:

GET

Request URL:

http://127.0.0.1:8000/mediahelp/mediaHelpPopup.html

 Using the URLconf defined in streamingmedia.urls, Django tried these URL patterns, in this order:
1.^mymedia/
2.^mediaadmin/
3.^mediahelp/ ^$
4.^mediahelp/ ^comphelp/$
5.^admin/

The current URL, mediahelp/mediaHelpPopup.html, didn't match any of these.
 
 
So far I've tried numerous variations for the popup's url with only 404's resulting. Do I need to return something other HttpResponse in my asynchronous view in order to get this to work? At this point since I'm rather new to attempting AJAX I'm just looking for the simplest solution for displaying the returned data in a non-modal popup. Can someone help or point me to a good and simple (using simple javascript only) tutorial for doing something like this?
 
 
 
 
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/sCb_cY7QI3UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment