Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Oct 4, 2016
1 parent 3b5d247 commit 7b77b8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ <h2>Example</h2>

<p>Run this code in a console or from anywhere (CORS and JSONP supported).</p>

<pre><code class="javascript">var root = '</code><code class="javascript" id="protocol">http:</code><code class="javascript">//jsonplaceholder.typicode.com';
<pre><code id="example" class="javascript">
var root = 'http://jsonplaceholder.typicode.com';

$.ajax({
url: root + '/posts/1',
Expand Down Expand Up @@ -189,7 +190,8 @@ <h2>Use your OWN data</h2>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
// Use http or https based on location.protocol
document.getElementById("protocol").innerHTML = location.protocol;
var exampleText = $('#example').text()
$('#example').text(exampleText.replace('http:', location.protocol))

// Highlight result element
$('#result').each(function(i, block) {
Expand Down

0 comments on commit 7b77b8c

Please sign in to comment.