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 8857037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:29:47+00:00 2026-06-14T14:29:47+00:00

Here’s some Javascript I use to create a widget on my site: var boxText

  • 0

Here’s some Javascript I use to create a widget on my site:

var boxText = document.createElement("div");
boxText.class = "infobox-custom";
boxText.style.cssText = "margin-top: -215px; margin-left: -500px; border-radius: 10px; background-color:#438BC0; padding: 5px; height: 400px; width: 600px;";

// Notice this:
boxText.innerHTML = '<p>Some text.</p>';

Pretty simple. I need to set the .innerHTML to something much more complex and just sploshing it into a single line in Javascript doesn’t feel right. It smells – at least to me.

What are my options here?

Can I have a PartialView and return that from my Controller to a jQuery POST request?

What do you recommend?

  • 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-14T14:29:48+00:00Added an answer on June 14, 2026 at 2:29 pm

    To be honest it seems like rendering the HTML and sploshing it into the single line is the simplest option, given what you’ve got so far.

    If you want to get more serious about having the UI dynamic via JavaScript, you should look into using JavaScript to render a template, and simply serve up data (JSON) from your backend (ASP).

    A few templating options:

    • underscore.js’s builtin option
    • handlebars.js
    • jquery-tmpl (~deprecated)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here's some sample HTML <style> .icon {display:none;} </style> <ul> <li>ABC <i id=abc class=icon>x</i></li> <li>DEF
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Basically, what I'm trying to create is a page of div tags, each has
Here is my AsyncTask. Getting exception in the AsyncTask.. private class GetCategories extends AsyncTask<String,
Here is a simple timepicker to jQuery UI's datepicker <script type=text/javascript> /* <![CDATA[ */

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.