Created
November 20, 2013 16:00
-
-
Save Valentino85/7565610 to your computer and use it in GitHub Desktop.
Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!--<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0">--> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title><%= content_for?(:title) ? yield(:title) : "Test site" %></title> | |
<%= csrf_meta_tags %> | |
</head> | |
<body class="home"> | |
<script> | |
$(document).ready(function() { | |
$.getJSON( "/api/products.json", function( data ) { | |
var items = []; | |
$.each( data["products"], function( key, val ) { | |
items.push( "<li id='" + key + "'>" + val["name"] + "</li>" ); | |
}); | |
$( "<ul/>", { | |
"class": "my-new-list", | |
html: items.join( "" ) | |
}).appendTo( "body" ); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment