如何在页面的不同区域显示值 [英] How to Display Values in different areas of a page

查看:90
本文介绍了如何在页面的不同区域显示值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我正在做一个asp.net项目,并使用jquery ajax发布数据并检索它.

这是下面的代码.



am doing an asp.net project and am using jquery ajax for post the data and retrive it.

Here is the below code.

$.ajax(
{
   type: "POST",
   url: "../../GeneralService.asmx/ShowBooked_Items",
   dataType: "json",
   data: JSON.stringify({ "Item_ID": $(this).attr('id') }),
   contentType: "application/json; charset=utf-8",
   success: function (json) {
      var output = $('#MyTemplate').parseTemplate(json);
      $('#MyTemplateOutput').html(output);
   }
});



这是HTML代码



and here is the HTML Code

 <div id="MyTemplateOutput">
   </div>
   <script id="MyTemplate" type="text/html">
   <table id="ContentPlaceHolder1_dlSub_Items" cellspacing="0" style="width:100%;border-collapse:collapse;">
   <#

      for(var i=0; i < d.length; i++)     

      {      

         var cust = d[i]; 

   #>
   // here is the code for Displaying dynamic datas.
   <# 

      }

   #>

</script>



这段代码工作正常.在这里,我已将其发布到"GeneralService.asmx",并在其中使用了通用列表"来获取数据并返回.

我的问题是,当我使用此代码时,它就可以正常工作.
我需要在页面的不同区域打印数据.

我该怎么做.请帮帮我.


谢谢

Dileep



This code is working Fine. Here Here i have posted to ''GeneralService.asmx'' and there i have used Generic List for taking the datas and returned.

And my question is When i have used this code then it is working fine.
I need to print datas in different areas of a page.

How i can do it. Please Help me.


Thanks

Dileep

推荐答案

.ajax( { 类型:" , 网址:" , dataType:" , 数据: JSON .stringify({" :
.ajax( { type: "POST", url: "../../GeneralService.asmx/ShowBooked_Items", dataType: "json", data: JSON.stringify({ "Item_ID":


().attr(' id')}), contentType:" , 成功:功能(json){ var 输出=
(this).attr('id') }), contentType: "application/json; charset=utf-8", success: function (json) { var output =


('
('#MyTemplate').parseTemplate(json);


这篇关于如何在页面的不同区域显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆