title: Access Spring MVC model object within jquery
body: <p>This is how I return my model object from the controller.</p>
  
  <pre><code>model.addObject("gameSchList", gameSchList);
  return model;
  </code></pre>
  
  <p>I got my response as a JSON output because I used Spring JAXB implementation.
  This is the output I got from my Spring controller.</p>
  
  <pre><code>{
     "gameSchList":
     [
         {
             "team":
             [
                 {
                     "alias": "A",
                     "logo": "A_LOGO"
                 },
                 {
                     "alias": "B",
                     "logo": "B_LOGO"
                 }
             ],
             "cName": "AZ",
             "id": "58",
             "type": "game",
             "channel": "713",
             "time": "Sun 13:00PM",
             "status": "pregame"
         }
     ]
  </code></pre>
  
  <p>}</p>
  
  <p>Now I want to access this gameSchList within document ready function. This is an external js file which I added to my homepage.</p>
  
  
  
  <p>Now within that gameinfo.js, I created a ready function and tried to access gameSchList using the below code. I need this requirement within js file without using jstl.</p>
  
  <pre><code>$(document).ready(function(){
      var list = ${gameSchList};
      $.each(list, function( index, value ) {
          alert( index + ": " + value );
      });
  });
  </code></pre>
  
  <p>When I call this controller it redirects to my homepage and executes this particular gameinfo.js, but it gives me this error:</p>
  
  <blockquote>
    <p>SyntaxError: missing ; before statement</p>
  </blockquote>
  
  <p>I tried it several ways, but no luck for me.</p>
  
  <pre><code>var list = ${model.gameSchList};
  var list = "${model.gameSchList}";
  </code></pre>