未捕获的ReferenceError:未定义结果...用于displayCars(结果);

时间:2015-03-16 18:33:24

标签: jquery arrays ajax json

我有以下代码段。我得到一个未捕获的ReferenceError:未定义结果...对于displayCars(result);

代码是:

<script type="text/javascript">

$(document).ready(function() {

displayCars(result);

function displayCars () {

    $.ajax({
        type : 'GET',
        url : '/modules/crm/selector-ajax.php',
        data : {
            'action' : 'get-images'
        },
        success : function(result) {

            var photoDiv = $('#boat_isotope_gallery');
            var divHtml = '';
            var resultArray = $.parseJSON(result);

            photoDiv.html(divHtml);

        },
        error : function(err) {
            console.log('ajax failure');
        }
    });
}
}); // end of document ready
</script>

我已经看过有关调用脚本顺序的帖子。我的脚本在头文档中调用。它们按以下顺序在上面的代码段之前调用:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script type="text/javascript" src="/scripts/tools.js"></script>
<script type="text/javascript" src="/scripts/jquerymenus.js"></script>
<script type="text/javascript" src="/scripts/chosen.jquery.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.cookie.js"></script>
<script type="text/javascript" src="https://netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js">   </script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/js/jasny-bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script> 
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js"></script>
<script type="text/javascript" src="/scripts/selector.js"></script>

为什么我收到此错误?

0 个答案:

没有答案