title: how to pass the string from django to javascript
body: <p>I used to pass the variables in terms of dictionary to HTML template in Django without any problem. Now I plan to add some javascript into the HTML file, and use the same way "{{ }}" to obtain the object from dictionary in javascript. All the objects in the dictionary are actually strings.
  In Django, the code is:</p>
  
  <pre><code>dataDict = {}
  dataDict["time"] = json.dumps(",".join(timeList))
  return render_to_response("xxxx.html", dataDict,\
           context_instance=RequestContext(request))
  </code></pre>
  
  <p>And in HTML page and Javscript, I just want use a string variable to receive it and then resolve the information I want, and our code is:</p>
  
  <pre><code>var test = {{ time }};
  </code></pre>
  
  <p>But it seems Django cannot pass the data to the string variable in Javascript. So I have two questions:</p>
  
  <ol>
  <li>Is there some special type of variable to pass the data from the Django to Javascript. Does JSON be possible? Or is it a must to convert string to JSON string in Django first before passing to Javascript?</li>
  <li>How to use the delivered string in Javascript? Apparently just use var xx = xxxx; doesn't work. We think we can pass data but it seems cannot be processed.</li>
  </ol>
  
  <p>Does anybody have some idea about it?</p>
  
  <p>Thanks!</p>