Edgar Navasardyan Edgar Navasardyan - 1 year ago 80
Ajax Question

Django Ajax - $.get method success function executed without ANY server-side view called

Deleted the previous question to clarify it a bit.

I have A Django powered website and a template with dynamically populated table.


<table id = 'my_table'>


$(function ()

function refresh_vednors_list_table()
$.get("/ajax_refresh_vendors_list_table/", function(response)


def ajax_refresh_vendors_list_table(request):
template = 'vendors/vendors_list_paginator.html'
vendors_qs = vendors_qs.filter(...)
context = {'vendors_qs':vendors_qs}
return render_to_response(template,

Template for the table (vendors_list_paginator.html)

{% load el_pagination_tags %}

{% paginate vendors_qs %}

{% for vendor in vendors_qs %}
{% endfor %}
{% show_more_table %}

When pressing each row in the table, I am redirected to the corresponding vendor's profile. After editing the profile, I press the back button and coming back again to the table page. At this stage, I start to debug the
$.get("/ajax_refresh_vendors_list_table/", data, function(response)

I also put a breakpoint at
template = 'vendors/vendors_list_paginator.html'
(let's call it breakpoint A)

A very strange behaviour is observed in
function: the corresponding Django view is not called (I don't see my app stop at breakpoing A) and yet
is executed directly as if the $.get function should execute successfully !!!!

In other words, $.get function is executed without any participation of server-side (I emphasize the word any. At first I thought that maybe I messed up the URLConf file and some other view was called. To check this, I cleared up the Django IDE console prior to pressing the browser back button and after pressing it, saw nothing in the Django IDE console meaning that $.get request successfully executed without ANY VIEW CALLED !!!)
Does it have something to do with pagination ? I am completely lost. Help please !

Answer Source

Hm... Looks like your browser is caching this request. Trying wrapping this url with never_cache

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download