未捕获的Sys.ParameterCountException:Sys.ParameterCountException:参数计数不匹配。

时间:2013-04-04 20:25:43

标签: jquery ajax google-maps-api-3 google-api

我正在使用Google的免费Distance Matrix API来计算两个地址之间的里程。我从地址传入地址并返回里程但返回错误说参数计数异常错误。

function calculateMiles(from, to) {
            $.ajax({
                type: "GET",
                url: "http://maps.googleapis.com/maps/api/distancematrix/json?origins=" + from + "&destinations=" + to + "&mode=driving&sensor=false&units=imperial"
            }).done(function(response) {
                var miles;
                $.each(response.rows, function() {
                    $.each(this.elements, function() {
                        miles = this.distance.text;
                        return false;
                    });
                    return false;
                });  
                $('#miles').val(miles);
            }).fail(function(response) {
                alert(response);
            });
        }

0 个答案:

没有答案
相关问题