Learning the Basics of jQuery.getJSON
info.json
- {
"name": "John"
}
the script
- $(document).ready(function(){
- $.getJSON('info.json', { hobby: "chess" }, function(json) {
- alert("name: " + json.name + " hobby: " + json.hobby);
- });
- });
This script will successfully display "John" in the alert, but not "chess." It displays "undefined" instead of "chess."
Any ideas what I'm doing wrong?