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

Commit

Permalink
Add link to GitHub. On error only show response status.
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanzdosilovic committed Sep 23, 2019
1 parent a29fa93 commit a9ece0b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Simple website for pretty printing JSON responses.">
<meta name="author" content="Herman Zvonimir Došilović">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>

<title>JSON Pretty Print</title>

<style>
#content {
font-family: 'Courier New', Courier, monospace;
Expand All @@ -16,7 +23,11 @@
var $content = $("#content");
var url = location.search.substr(1).trim();
if (url === "") {
$content.html("<p style=\"color: red;\">Please provide URL.</p> Example: https://jsonpp.judge0.com?<strong>https://api.judge0.com/languages</strong>");
$content.html("\
<p style=\"color: red;\">Please provide URL.</p>\
<p>Example: https://jsonpp.judge0.com?<strong>https://api.judge0.com/languages</strong></p>\
<small>Source code available on <a href=\"https://github.com/judge0/jsonpp\">GitHub</a>.</small>\
");
}
else {
$.ajax({
Expand All @@ -27,11 +38,11 @@
$content.html(JSON.stringify(data, null, 4));
}
else {
$content.html("<p style=\"color: red;\">Response is not a JSON.</p>");
$content.html("<p>Response is not a JSON.</p>");
}
},
error: function(jqXHR, textStatus, errorThrown) {
$content.html(JSON.stringify(jqXHR, null, 4));
$content.html(`<p>${jqXHR.status}</p>`);
}
});
}
Expand Down

0 comments on commit a9ece0b

Please sign in to comment.