-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestparser.html
More file actions
146 lines (120 loc) · 4.05 KB
/
testparser.html
File metadata and controls
146 lines (120 loc) · 4.05 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AJAX calls using Jquery in Servlet</title>
<script src="http://code.jquery.com/jquery-latest.js">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#tokenizer').click(function(event) {
/* This was the original version */
//var pattern=$('#input').val();
//$.get('parsetidal',{input:pattern},function(responseText){
// $('#tokenized').text(responseText);
//});
$.ajax({
url: 'parsetidal',
data: 'd1 $ sound "bd sn cp bev"',
dataType : 'json',
contentType: 'application/json',
method: "GET",//method,
success: function(data, state, res){
//dabutton.setAttribute('disabled',false);
dabutton.attr('disabled',false);
edit_box.css('border-color', 'yellow');
edit_box.css('color', 'yellow');
if(data){
}
},
error: function(data, state){
//dabutton.setAttribute('disabled',false);
edit_box.css('border-color', 'red');
//$error.text(state);
console.log("Data is:");
console.log(data);
console.log("Error is:"+ state);
notes_box.val("Error is:"+ state);
}
});
});
});
/*
$.ajax({
url: urlname,
data: msgdata,
dataType : 'json',
contentType: 'application/json',//; charset=UTF-8', // This is the money shot
//data: 'd1 $ sound "bd bd bd bd sn sn sn sn "',
//contentType: 'text',
method: method,
//This function is run when the request succeeds:
success: function(data, state, res){
//dabutton.setAttribute('disabled',false);
dabutton.attr('disabled',false);
edit_box.css('border-color', 'yellow');
edit_box.css('color', 'yellow');
if(data){
var answerPattern = ""
if(gaction == "push"){
answerPattern = $(edit_box).val();
// create popn member
if(data.valid == "true"){
notes_box.val("Valid pattern found (value is "+data.valid+")");
//$('#parserfb').val("Valid pattern found (value is "+data.valid+")");
add_to_pop(edit_box.val(),1.0);
}
else{
notes_box.val("Pattern isn't valid (value is "+data.valid+")");
//$('#parserfb').val("Pattern isn't valid (value is "+data.valid+")");
}
}
if(gaction == "pullmut"){
answerPattern = data.response;
notes_box.val("Mutation found (shown above)");
}
//edit_box.text(data);
notes_box.text("We should be seeing text: '"+answerPattern+"'");
//edit_box.text(data.response);
edit_box.focus();
edit_box.val(answerPattern);
edit_box.trigger('textInput');
ctr = jQuery.Event("keydown");
ctr.which = 65;
ctr.keyCode = 65;// # Some key code value
//$("body").trigger(ctr);
edit_box.trigger(ctr);//'keydown');
edit_box.change();
console.log("data is '"+answerPattern+"'");
}else{
edit_box.text('no data, STATUS CODE: ' + res.status);
}
},
error: function(data, state){
//dabutton.setAttribute('disabled',false);
edit_box.css('border-color', 'red');
//$error.text(state);
console.log("Data is:");
console.log(data);
console.log("Error is:"+ state);
notes_box.val("Error is:"+ state);
}
});
}
edit_box.focus();
}*/
</script>
</head>
<body>
<form id="form1">
<h1>Test The Tidal Tokenizer</h1>
Enter a tidal string:
<textarea id="input" rows="6">d1 $ sound "bd sn cp bev"</textarea>
<input type="button" id="tokenizer" value="Tokenize"/>
<br/>
<div id="tokenized">
</div>
</form>
</body>
</html>