Switching pages using AJAX in Django

I am trying to create site navigation using AJAX. I have a navigation menu with links to different views (using {% url name %}in the template). What I'm trying to do is load the contents of the page using AJAX. The content of the page I'm trying to load is contained in the content block ( {% block content %}).

I also found this snippet http://djangosnippets.org/snippets/942/ , but I want to use the views I have already defined and only get content with ajax.

Any suggestions?

+5
source share
2 answers

django-pjax, .

, , block content , ajax .

django-pjax AJAX jQuery API push5 HTML5, , IE.

+6

, {% block content %}, , AJAX . , , - <div>, :

{% block content %}
<div id="content"></div>
{% endblock content %}

- (jQuery) <div> :

$("#content").load(url, data, loadComplete);

url - URL, (HTML ), data - ( , ), loadComplete - , , function loadComplete(responseText, textStatus, XMLHttpRequest) {...}. jQuery, jQuery , .

+3

All Articles