title: retrieveing info from python dict with javascript
body: <p>I have such stuff in my django view:</p>
  
  <pre><code>message = 'sometext'
  rating = 7
  data = {'message':message, 'rating':rating}
  from django.utils import simplejson
  return HttpResponse(simplejson.dumps(data))
  </code></pre>
  
  <p>and this in my site.js:</p>
  
  <pre><code>$.ajax({
   'type': "POST",
   'url': url,
   'data': {'rating':rating},
   'success': function(msg){
    alert(msg['rating']);
    $.modal('&lt;p&gt;'+msg+'&lt;/p&gt;');
    $(".simplemodal-container").css("height", "auto");
   },
   'error' : function(){
    $.modal('&lt;p&gt;Hinnangu salvestamine ebaõnnestus&lt;/p&gt;');
    $(".simplemodal-container").css("height", "auto");
   }
  });
  </code></pre>
  
  <p>the simplemodel window returns me information like this:</p>
  
  <pre><code>{"rating": "7", "message": "sometext"}
  </code></pre>
  
  <p>alert on previous line just returns 'undefined'</p>
  
  <p>Why? Whats missing?
  i read about javascript dictionaries here: 
  <a href="http://rick.measham.id.au/javascript/hash.htm" rel="nofollow noreferrer">http://rick.measham.id.au/javascript/hash.htm</a>
  and according to that, the alert should display '7' not 'undefined' or not?</p>
  
  <p>Alan</p>