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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:11:27+00:00 2026-06-08T09:11:27+00:00

I was trying to populate a jQuery template and append the result into a

  • 0

I was trying to populate a jQuery template and append the result into a div, but I am getting an error. I just do not understand where the flaw is in my code. Can anyone rectify it? I am using jQuery version 1.4 (jquery-1.4.1.min.js).

Here is my full code:


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
.no_results
{
    width:547px;
    height:50px;
    overflow: hidden;
    text-align: center;
    margin-top: 25px;
    -moz-box-shadow: 3px 3px 4px #000;
    -webkit-box-shadow: 3px 3px 4px #000;
    box-shadow: 3px 3px 4px #000;  
    display:table-cell; 
    vertical-align:middle;
    background:none repeat scroll 0 0 #FFFFE0;
    border:1px solid #FFC978;
}
</style>

<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var srchterm = 'Hello Sam';
var markup = "<ul><li><div class='no_results'><span>No results found for [${Name}] </span></div></li></ul>";

$("#showBtn").click(function () {
$("#SearchData").empty();
$.tmpl("movieTemplate", srchterm).appendTo("#SearchData");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="showBtn" runat="server" Text="Change" /><br /><br />
<div id="SearchData"></div>
</form>
</body>
</html>
  • 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-08T09:11:30+00:00Added an answer on June 8, 2026 at 9:11 am

    Is this what you are trying to achieve:
    http://jsfiddle.net/2efSV/

    I’ve changed your call to $.tmpl from

    $.tmpl("movieTemplate", srchterm).appendTo("#SearchData");
    

    to

    $.tmpl(markup, { "Name" : srchterm  }).appendTo("#SearchData");
    

    The first parameter should be your template, and the second should be an object containing the data you’re using in the template:

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

Sidebar

Related Questions

I am trying to populate a spinner, but am getting an error. Here is
I trying to populate the dropdown list when page was loaded.But it is not
I am trying to build a simple jQuery UI template and populate it with
I am trying to populate a table using jQuery $.post , but I keep
How can I do this in Javascript/jQuery from PHP? I am trying to populate
I am trying to populate a ListView ....but I cant add 2 string values
I am trying to populate a dropdown select with an array using jQuery. Here
I am trying to populate a chart with button click. <html> <head> <script src=https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js></script>
I am trying to populate a div with the value of an <option> in
I'm trying to download a CSV file to populate a graph with jQuery. Everything

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.