Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Can not get textfield value fetched from MySQL in javascript

I created a model in django like below.

class MyDB(models.Model):
    pub_date = models.DateTimeField(_("Date added"),editable=True, auto_now_add=False)
    title = models.CharField(max_length=256,blank=True,null=True)
    text = models.TextField(_("Text"))

Then I got the model and mapped into Frontend.

in views.py file

context['mydb'] = MyDB.objects.all()

in HTML file

let plots = [];
{% for d in mydb %}
    var id = '{{ d.id }}';
    var title = '{{ d.title }}';
    var text = '{{ d.text }}';        
    console.log(text)
        
{% endfor %}

When the text contains 'enter' in string. it raise error.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Please try to replace ' with ` (backtick), it should fix your issue (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#multi-line_strings)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!