Blame view

static/js/application.js 767 Bytes
ffd3b3723   Killian   idem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  // 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"]+"
  "));
  			});
  			console.log(_.escape(data));
  			console.log("resultat");
  		},
  		error: function(){
  			alert("error");
  		},
  		dataType: "text",
  		contentType:"application/json; charset=UTF-8"
  	});
  });
  }