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

  • SEARCH
  • Home
  • 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 6916297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:35:02+00:00 2026-05-27T09:35:02+00:00

In our app we use javascript to pump the incoming JSON data into presentable

  • 0

In our app we use javascript to pump the incoming JSON data into presentable HTML. I’ve ben using JQuery template for this.
I have begun to notice that I’ve been using more and more html Strings In JS code. for ex:

render = function(data, parent){

   var header, analyticsHtml, analyticsTmpl;
   header= parent.find(".header");
   header.append('<H3>'+ i18n['header']+'</H3>');
   analyticsHtml = '<div><div class="floatLeft" id="analytics"><div class="gt"><span>01</span><br />i18n['Text1']</div></div></div>';
   parent.append(analyticsHtml);
   analyticsTmpl = "....blah...";

   $('#analytics').append($.tmpl(analyticsTmpl, data));
   .
   .
   .

}

Is it ok to use html strings within JS code?

  • 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-05-27T09:35:03+00:00Added an answer on May 27, 2026 at 9:35 am

    Yes, it’s OK, but you have to escape the quote characters you use with “\”.

    analyticsHtml = '<div><div class="floatLeft" id="analytics"><div class="gt"><span>01</span><br />' + i18n['Text1'] + '</div></div></div>';
    

    In your code, you forgot the “+” operators for the “i18n” array reference.

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

Sidebar

Related Questions

In our web-app we use PHP5.2.6 + PDO to connect to a SQL Server
Our app servers (weblogic) all use log4j to log to the same file on
I want to use modal pop-up windows in our web app in Ruby on
I'm refurbishing a simple web-app that our field techs use. One of my goals
We have a 12-year-old Ms Access app that we use for our core inventory
Our app (already deployed) is using an Access/Jet database. The upcoming version of our
A user registers on our Rails app and they're given javascript to embed a
We're using Selenium with the Java API and some Javascript user extensions. We use
we are after a JavaScript spell checker to run on our web app. it
I am integrating Facebook authentication, registration and app requests with our web app, using

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.