Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8828783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:41:11+00:00 2026-06-14T07:41:11+00:00

<script> //Handle the callback on success function stateChange(){ if (xmlHttp.readyState==4 && xmlHttp.status==200) { //request

  • 0
<script>

 //Handle the callback on success

 function stateChange(){

    if (xmlHttp.readyState==4 && xmlHttp.status==200) {

    //request is successful. So retrieve the values in the response
    var display_language = xmlHttp.responseText.split(';');
    alert("response: " + display_language);

    var newHtml = '{% for chunk in video.chunks.all %} {% for c in chunk.chunklets.all%} <tr> <td>{{c.start}}</td> <td> {% spaceless %} {%for item in c.contents.all%}{%if item.lang ==  display_language %}{{item.text.strip}}{%endif%}{%endfor%} {% endspaceless %} </td> <td>{{c.finish}}</td> </tr> {%endfor%} {%endfor%}';

    $('#xxx').html(newHtml);
    }
}
</script>

If I use the above code, the display_language value is null. But alert can print the value of display_language. Just the display_language can not be passed into newHtml.

If it is changed to

var newHtml = '{% for chunk in video.chunks.all %} {% for c in chunk.chunklets.all%} <tr> <td>{{c.start}}</td> <td> {% spaceless %} {%for item in c.contents.all%}{%if item.lang ==';

newHtml +=  display_language +'%}{{item.text.strip}}{%endif%}{%endfor%} {% endspaceless %} </td> <td>{{c.finish}}</td> </tr> {%endfor%} {%endfor%}';

The error is that “”Invalid block tag: ‘endif’, expected ’empty’ or ‘endfor’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:41:12+00:00Added an answer on June 14, 2026 at 7:41 am

    You’re trying to mix Javascript and Django templates too much. Remember that all of the Django is run first, and then all of the javascript will be run. So because the display_language value is created in Javascript, you can’t use it in your Django template. I would recommend just passing all of your data into Javascript, and then constructing your newHtml value in pure javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

currently i am relying on a proxy script to handle this problem of Single
The engine I use calls the jquery tabs.js script to handle the tab functions.
I'm trying to write a Perl CGI script to handle XML-RPC requests, in which
I need to handle strings in my php script using regular expressions. But there
I was wondering how to handle errors inside a script that is meant to
I'm writing a batch (.bat) script and I need to handle the case in
I need to modify a php search script so that it can handle multiple
I have a problem with a script and I don't know how to handle
I have to request data for a JS-script from a MySQL database (based upon
One of the successful load is like that: http://gdata.youtube.com/feeds/api/videos/N7m86aMNjlQ?callback=jsonp1335008664824&alt=json-in-script However, when the video is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.