Work on ajax
This commit is contained in:
parent
351ec72299
commit
42aee030e1
@ -210,12 +210,14 @@ function onQuery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.getJSON('/node/hscd/keywords', function(data) {
|
$.getJSON('/node/hscd/keywords', function(keywords) {
|
||||||
for (var keyword in data) {
|
for (var i = 0; i < keywords.length; ++i) {
|
||||||
$('#query').append($('<option></option>', {
|
$('#query').append($('<option></option>', {
|
||||||
'value': keyword,
|
'value': keywords[i],
|
||||||
'text': keyword
|
'text': keywords[i]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#search').prop('disabled', false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-2 col-md-10">
|
<div class="col-md-offset-2 col-md-10">
|
||||||
<button class="btn btn-primary" id="search" type="button">
|
<button class="btn btn-primary" id="search" type="button" disabled="disabled">
|
||||||
<span class="glyphicon glyphicon-search"></span> Search
|
<span class="glyphicon glyphicon-search"></span> Search
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -100,9 +100,8 @@
|
|||||||
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
|
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||||
<script src="bower_components/fabric/dist/fabric.min.js"></script>
|
<script src="bower_components/fabric/dist/fabric.min.js"></script>
|
||||||
|
|
||||||
|
<script src="application.js"></script>
|
||||||
<script src="grapher.js"></script>
|
<script src="grapher.js"></script>
|
||||||
<script src="projection.js"></script>
|
|
||||||
<script src="data.json"></script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "~4.5.1"
|
"express": "~4.5.1",
|
||||||
|
"underscore": "^1.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var keywords = require('./db/keywords.json');
|
var keywords = require('./db/keywords.json');
|
||||||
var data = require('./db/data.json');
|
var data = require('./db/data.json');
|
||||||
|
var _ = require('underscore');
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
var app = express();
|
var app = express();
|
||||||
@ -10,7 +11,7 @@ function main() {
|
|||||||
|
|
||||||
router.use('/keywords', function(req, res, next) {
|
router.use('/keywords', function(req, res, next) {
|
||||||
console.log('Requesting keywords');
|
console.log('Requesting keywords');
|
||||||
res.json(keywords);
|
res.json(_.keys(keywords));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use('/hscd', router);
|
app.use('/hscd', router);
|
||||||
|
Loading…
Reference in New Issue
Block a user