开发者

Django + jquery : getting 301

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' },
                          开发者_如何学Pythoncontext_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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜