Skip to content
This repository was archived by the owner on Oct 11, 2020. It is now read-only.

Commit a9ece0b

Browse files
Add link to GitHub. On error only show response status.
1 parent a29fa93 commit a9ece0b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

index.html

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<meta charset="UTF-8">
5+
<meta name="description" content="Simple website for pretty printing JSON responses.">
6+
<meta name="author" content="Herman Zvonimir Došilović">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
49
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
10+
511
<title>JSON Pretty Print</title>
12+
613
<style>
714
#content {
815
font-family: 'Courier New', Courier, monospace;
@@ -16,7 +23,11 @@
1623
var $content = $("#content");
1724
var url = location.search.substr(1).trim();
1825
if (url === "") {
19-
$content.html("<p style=\"color: red;\">Please provide URL.</p> Example: https://jsonpp.judge0.com?<strong>https://api.judge0.com/languages</strong>");
26+
$content.html("\
27+
<p style=\"color: red;\">Please provide URL.</p>\
28+
<p>Example: https://jsonpp.judge0.com?<strong>https://api.judge0.com/languages</strong></p>\
29+
<small>Source code available on <a href=\"https://github.com/judge0/jsonpp\">GitHub</a>.</small>\
30+
");
2031
}
2132
else {
2233
$.ajax({
@@ -27,11 +38,11 @@
2738
$content.html(JSON.stringify(data, null, 4));
2839
}
2940
else {
30-
$content.html("<p style=\"color: red;\">Response is not a JSON.</p>");
41+
$content.html("<p>Response is not a JSON.</p>");
3142
}
3243
},
3344
error: function(jqXHR, textStatus, errorThrown) {
34-
$content.html(JSON.stringify(jqXHR, null, 4));
45+
$content.html(`<p>${jqXHR.status}</p>`);
3546
}
3647
});
3748
}

0 commit comments

Comments
 (0)