views:

57

answers:

0

I'm working with jquery.ajax() I'm getting a object and I use jTemplate to write the html. My problem is now that I need to place the id of the object in a input hidden. I have no idea how I should do this. I tried to do a <script> in the template.htm with jquery to place the id in hidden but with no luck.

Any suggestions?

this is my jTemplate html file

<div style="background-color: #ccc">
    {$T.Email}
</div>

<div style="background-color: #ddd">
    {$T.Password}
</div>

This is my jquery

$('a').live('click', function(evt) {
                evt.preventDefault();
                var id = $(this).attr('id');
                $.ajax({
                    type: "POST",
                    url: "GetUserWeb.asmx/GetUser",
                    data: "{'value': '" + id + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(msg) {
                        ApplyTemplate(msg);
                    },
                    error: function(xhr, err) {
                        alert("readyState: " + xhr.readyState + "\nstatus: " + xhr.status);
                        alert("responseText: " + xhr.responseText);
                    }
                });
            });

            function ApplyTemplate(msg) {
                $('#Container').setTemplateURL('template.htm');
                $('#Container').processTemplate(msg.d);
            }