Skip to content

Instantly share code, notes, and snippets.

@ilkerde
Created August 30, 2011 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilkerde/1181500 to your computer and use it in GitHub Desktop.
Save ilkerde/1181500 to your computer and use it in GitHub Desktop.
double array indexer access example for @asp_net
{
"Username": {
"de-DE": "Benutzername",
"en-US": "Username"
},
"Language": {
"de-DE": "Sprache",
"tr-TR": "Dil"
}
}
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
$("#apply").click(function(){
$.getJSON('data.js', function(data){
var label = $("#label").val();
$("#what").text(data[label] ? data[label]["de-DE"] : "n/a");
});
});
});
</script>
</head>
<body>
<div id="control">
<label for="label">Label:</label><input type="text" name="label" value="Username" id="label" />
<input type="button" id="apply" value="Go" />
</div>
<div id="what">
The german translation for given label should appear here.
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment