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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:44:37+00:00 2026-05-22T01:44:37+00:00

I am trying to experiment with the jquery template plugin. I have a single

  • 0

I am trying to experiment with the jquery template plugin.

I have a single template defined as this:

<script id="referentTemplate" type="text/x-jquery-tmpl">
<form id="referent-form" method="post" action="#">
<div class="fields">
    <input type="hidden" name="referentID" value="${ReferentID}" />
    <table>
        <tr><td><label for="firstName">First Name</label><br />
                <input type="text" name="firstName" value="${FirstName}" /></td>
            <td><label for="lastName">Last Name</label><br />
                <input type="text" name="lastName" value="${LastName}" /></td></tr>
        <tr><td><label for="fullName">Full Name</label><br />
                <input disabled="disabled" type="text" name="fullName" value="${FirstName} ${LastName}" /></td></tr>
        <tr><td><label for="phoneNumber">Telephone</label><br />
                <input type="text" name="phoneNumber" value="${PhoneNumber}" /></td>
            <td><label for="email">EMail</label><br />
                <input type="text" name="email" value="${Email}" /></td></tr>
    </table>
</div>
<div id="validation-message"></div>
<div style="text-align:right; padding: 8px 0px 0px 0px;">
    <input type="submit" id="btnSave" class="button" value="Save" />
    <input type="button" id="btnCancel" class="button" value="Cancel" />
</div>
</form>
</script>

I would like to load this template dinamically using the following code

$("#new-referent").click(function () {
    $.ajax({
        type: "get",
        url: baseUrl + 'MyService.asmx/New',
        data: JSON.stringify({}),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            // Get the referent item from the webservice
            var referent = msg.d;
            // Render the template with the Referent data
            var referentTemplate = $("#referentTemplate").tmpl(referent);
            //Show the Dialog
            $("#referent-dialog").empty().html(referentTemplate).dialog('open');
        }
    });
});

Everything works very nice except for the fact that the form inputs does not contains the data that is returned from the server. I have checked the data coming back with fiddler and it contains right values like this

{"d":"{\"ReferentID\":-1,\"LastName\":\"Abbot\",\"FirstName\":\"John\",\"FullName\":null,\"PhoneNumber\":null,\"Email\":null}"}

Where I am doing wrong?

Thanks for helping!

  • 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-22T01:44:37+00:00Added an answer on May 22, 2026 at 1:44 am

    Apparently your website returns a JSON object containing only one key d which contains a JSON string.

    So you need to use var referent = JSON.parse(msg.d); or (which would be better) return proper JSON.

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

Sidebar

Related Questions

I'm trying to experiment with software defined radio concepts. From this article I've tried
I'm trying to experiment with the non- JTextArea Swing text components, and in this
I'm trying to accomplish what's being demonstrated at this site for an experiment I'm
I'm doing a little experiment, trying to alternate background colours for nested divs. This
I've been trying to get this really simple example of using AJAX with JQuery
maybe this is an old question but i'm trying as a personal experiment to
I'm trying to understand and experiment with node.js and am interested in how this
I am trying to use a jQuery plugin to implement Expand all Divs/ Collapse
I'm just trying to experiment some ListBox functionality in the SelectionChanged event. I have
I'm trying to experiment with SVG on Firefox. Since I'm using jQuery, I'd like

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.