我收到错误:
未捕获的类型错误:$.get 不是函数
如果jquery在加载此功能之前我没有导入,我会理解
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"
integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"
integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"
integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn"
crossorigin="anonymous"></script>
<script>
window.loadCurrentLocation = function(){
$.get("{% url "locations:ajax_get_current_location" %}").done(function (data) {
{# TODO: Osetrit ak neexistuje#}
$('#id_my_current_location').text(data.name);
}
)
};
window.setUserLocation = function(){
var place_id = $('#id_this_place_id').val();
var name = $('#id_this_name').val();
$.get("{% url "locations:ajax_set_current_user_location" %}?place_id=" + place_id + "&name=" + name).done(function (data) {
loadCurrentLocation();
})
}
</script>
Run Code Online (Sandbox Code Playgroud)
你知道问题出在哪里吗?