Всем привет. Не могу запустить Loading remote data из примера
<!DOCTYPE HTML>
<html>
<title>Untitled</title>
<meta charset="utf-8">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-beta.3/css/select2.min.css" rel="stylesheet" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-beta.3/js/select2.min.js"></script>
<style>
.selectRow {
display : block;
padding : 20px;
}
.select2-container {
width: 200px;
}
</style>
<script>
$( document ).ready(function() {
$(".js-data-example-ajax").select2({
ajax: {
url: "https://api.github.com/search/repositories",
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function (data, page) {
// parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to
// alter the remote JSON data
return {
results: data.items
};
},
cache: true
},
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: 1,
templateResult: formatRepo, // omitted for brevity, see the source of this page
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
});
});
</script>
</head>
<body>
<body>
<select class="js-data-example-ajax">
<option value="select2/select2" selected="selected">select2/select2</option>
</select>
</body>
</body>
</html>
Он так будет работат?
в консоле ошибка Uncaught ReferenceError: formatRepo is not defined
в чем проблема?