tags:

views:

42

answers:

2

Hello,

I have tabs that calls via javascript urls of django to complete the "container"

But i am getting 301, any idea why this is happening?

Server misconfiguration?

urls.py

urlpatterns = patterns('',
     (r'^admin/', include(admin.site.urls)),
     (r'^list/', 'carsproj.cars.views.list'),
)

view

def list(request):
if request.is_ajax():
    return render_to_response('templates/generic_list.html',
                          { 'items' : Cars.objects.all(), 'name' : 'List - Cars' },
                          context_instance = RequestContext(request))

javascript

the_tabs.click(function(e){

    var element = $(this);

    if(element.find('#overLine').length) return false;

    var bg = element.attr('class').replace('tab ','');

    $('#overLine').remove();

    $('<div>',{
        id:'overLine',
        css:{
            display:'none',
            width:element.outerWidth()-2,
            background:topLineColor[bg] || 'white'
        }}).appendTo(element).fadeIn('slow');


    if(!element.data('cache'))
    {   
        $('#contentHolder').html('<img src="/media/img/ajax_preloader.gif" width="64" height="64" class="preloader" />');

        $.get(element.data('page'),function(msg){
            $('#contentHolder').html(msg);

            element.data('cache',msg);
        });
    }
    else $('#contentHolder').html(element.data('cache'));

    e.preventDefault();
})

Please tell me what more information you need, js code? template? url.py? I WILL EDIT THIS POST FOR ADD MORE DATA

A: 

An HTTP 301 is a redirect. Without seeing the actual output, I'd guess you might need to authenticate first.

Jack M.
do you think that jquery .get is doing that?I know what is 301, but dont know why is happening
llazzaro
I highly doubt it. Something is sending you a redirect, and you need to figure out what/why.
Jack M.
A: 

The problem was adsense code!! remove the adsense from the ajax response and now its workign!

llazzaro