-
Notifications
You must be signed in to change notification settings - Fork 0
/
validator.html
61 lines (50 loc) · 1.91 KB
/
validator.html
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
<!DOCTYPE HTML>
<html>
<head>
<title>Semantic Graph App</title>
</head>
<body >
<form method="post" enctype="multipart/form-data" action="http://validator.w3.org/check">
<input type="hidden" name="charset" value="utf-8"/>
<input type="hidden" name="doctype" value="SVG 1.1"/>
<input type="hidden" name="group" value="0"/>
<input type="hidden" name="user-agent" value="W3C_Validator/1.3 http://validator.w3.org/services"/>
<textarea cols="80" rows="12" name="fragment" id="fragment"><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><!-- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> --><svg xmlns="http://www.w3.org/2000/svg" version="1.1" image-rendering="auto">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
</svg>
</textarea>
</form>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
var xmlhttp;
var form = document.forms[0];
if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
alert(xmlhttp.responseText);
}
}
var url = "http://validator.w3.org/check";
var params = {"charset":"utf-8","doctype":"SVG 1.1","group":"0","user-agent":"W3C_Validator/1.3 http://validator.w3.org/services","fragment":"src"};
var data = new FormData();
for(p in params){
data.append(p,params[p]);
}
$.ajax({
url: url,
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(data){
alert(data);
}
});
</script>
</body>
</html>