Click here to Skip to main content
12,699,492 members (34,931 online)
Rate this:
Please Sign up or sign in to vote.

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

Here is the below code.

   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);

and here is the HTML Code

<div id="MyTemplateOutput">
   <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.


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.


Posted 21-Aug-12 5:49am
Updated 21-Aug-12 7:48am
Sandip.Nascar 21-Aug-12 12:26pm
Didn't get you actually. By different locations, did you mean to show data in different areas of the page. If yes you can place display controls in different areas as per your requirement and render with proper data.
dilzz 21-Aug-12 12:29pm
yes, that i meaned, i need to show datas in different areas in a page
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you want the data shown in different areas, you need to write cod eto show it, and if your AJAX call updates it, update them all.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Well, as per your comment dilzz,
The simplest approach is to design the page with different divs.

so on..

Now in ajax call "success", you get the data
Iterate the data to get specific value and assign to div innerhtml

so on...

Hope this helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 21 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100