application.js
767 Bytes
// Some general UI pack related JS
$(document).ready(function() {
tagging();
});
function tagging(){
$('#go').click(function(){
data=JSON.stringify({ "string" : $('#data').val() });
console.log(data);
$.ajax({
type: "POST",
url: "tagger",
data: data,
success: function(data){
data = JSON.parse(data);
result=$('#result');
_.each(data, function(element, index, list){
console.log(element);
result.append(_.escape(element["word"])+" ");
result.append(_.escape(element["markup"]+" "));
result.append(_.escape(element["lemm"]+"\n"));
});
console.log(_.escape(data));
console.log("resultat");
},
error: function(){
alert("error");
},
dataType: "text",
contentType:"application/json; charset=UTF-8"
});
});
}