ajax成功功能,不会出现项目

时间:2014-02-11 16:55:21

标签: jquery ajax django

很奇怪,我在萤火虫中得到200 OK但是没有显示返回项目。尝试过使用每个循环但没有成功。 错误功能中不会出现错误。 Console.log消息和警报永远不会显示在控制台上。

$('#buscafrete').click(function(e) { 

    e.preventDefault();
    cep = $('#cep').val();
    $.ajax({
        type:'POST',
        url: "{% url 'get_frete' %}",
        dataType: "json",
        data: {
            data:cep,
            csrfmiddlewaretoken:'{{csrf_token}}',
        },        
        sucess: function(retorno){
            $.each(retorno, function(i, item) {
            console.log(i);
            console.log(item);
            console.log("TEST");
            alert("TEST");
            });                
        },
        error: function(jqXHR, textStatus, errorThrown){
            //alert("FALHOU");
            console.log('Error');
            console.log(jqXHR);
            console.log(textStatus);
            console.log(errorThrown);
        },
    });

});

2 个答案:

答案 0 :(得分:1)

您有错字:sucess应为success

答案 1 :(得分:0)

你的成功功能有一个错误,有拼写错误功能应该是成功而不是成功 它不会显示任何错误,但您的代码将无法正常工作。

相关问题