Skip to content

Commit

Permalink
change option loading
Browse files Browse the repository at this point in the history
also move select2 (cf. 9c3c445)
Cf. #3
  • Loading branch information
dariok committed Nov 6, 2018
1 parent 20e4993 commit b868d54
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions form.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
var conf = [];
$.getJSON('config.json', function(data) {
conf.push(data);
var conf =[];
$.getJSON('config.json', function (data) {
conf = data.data;
});

$('#form_people').select2({
minimumInputLength: 2,
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
return data.text;
},
templateSelection: function(data) {
return data.text;
},
ajax: {
url: function() { return conf.server + $('#type').val() + '/' },
dataType: 'json',
processResults: function (data) {
return { results: process(data) };
}
}
});

$('body').on('submit', 'form#person-form', function(event) {
$('body').on('submit', 'form#person-form', function (event) {
event.stopPropagation();
event.preventDefault();
var link = $('select#form_people').val();
console.log( link );
insertLink ( link );
console.log(link);
insertLink (link);
});

0 comments on commit b868d54

Please sign in to comment.