On Wed, Oct 12, 2011 at 11:38 AM, Javier Guerra Giraldez <javier@guerrag.com> wrote:
On Wed, Oct 12, 2011 at 9:39 AM, lankesh87 <lankesh.87@gmail.com> wrote:i think you really need to check how HTTP works.
> I mean if we could only refrsh particular part in our web page without
> refreshing the whole page "using django".
in HTTP, the server can't "push" anything to the browser. the browser
has to ask for it.
Django runs exclusively in the server.
the only browse-side coding environments are javascript and some
plugins (flash, Java, silverlight). in general, only Javascript is
practical.
you want to replace part of the webpage with different content,
probably in response of some user interaction. That has to be
initiated at the browser. Since you don't want to replace the whole
page, it has to be some Javascript code that 'pulls' the new content
from the server and replaces some part of the page with it.
guess what? that javascript-driven requests are called AJAX (even if
the 'X' doesn't imply XML anymore).
using a javascript library it can be real simple. in jQuery it's:
$('#partid').load('http://some.url/with/new/content');
from the Django point of view, it will simply get a request for the
new URL, and it should return the partial content. jQuery will patch
it replacing the content of the '#partid' element of the page
but you _really_ have to understand HTTP and javascript to go from
there to anywhere else.
--
Javier
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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