1👍
✅
If entry.Col1 contains string ‘my text’, resulting template will give you lines like this:
dCell.push(my text);
and, i suppose, you need
dCell.push('my text');
0👍
Make sure that this is executing after the DOM is loaded.
Try wrapping your script like:
window.onload=function(){
//script here
}
You can see on jsfiddle that this should be working.
Update:
It seems to be a problem with how Django is inserting data since it works with hardcoded sample data. Try the escapejs template filter to handle any potential javascript escaping problems. I’ve had to debug similar problems before with newlines and ‘&’ symbols in particular.
dCell.push("{{ entry.Col1|escapejs }}");
- [Answer]-In a Django template, how do I access attributes of a dict element whose key has a space?
- [Answer]-Use existing html page elements (its form and button) withing django app
- [Answer]-AngularJS $http.post not getting JSON success response. Instead redirects to URL of the REST endpoint
Source:stackexchange.com