Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How to receive dataset in jquery

How to receive dataset in jquery

Scheduled Pinned Locked Moved Web Development
javascripttutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goplappu
    wrote on last edited by
    #1
    D 1 Reply Last reply
    0
    • G goplappu
      D Offline
      D Offline
      Dennis E White
      wrote on last edited by
      #2

      question, statement or are you just giving us your current status?? :) the way that I have generally done something like this is to call some

      [WebMethod]

      either in a web service or a page method. technically those

      public static

      page methods are nothing but web service methods. at least in my opinion they are.

      [WebMethod]
      [System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)]
      public DataTable someMethod(string param)
      {
      DataSet dsReturn;

       try
       {
            // do your database stuff
      
            // I like to name the table so that it makes parsing it in jQuery easier for me
            dsReturn.Tables\[0\].TableName = "someName";
       }
       catch (Exception)
       {
            // do your error handling
            throw;
       }
      
       return dsReturn.Tables\[0\];
      

      }

      then my jQuery code I use the

      $.ajax(...)

      function to call the web service.

      $.ajax({
      type: 'POST',
      url: 'location/name.asmx/someMethod',
      data: "{ 'param': 'paramValue' }",
      contentType: 'application/json; charset=utf-8',
      dataType: 'xml',
      success: function (xml) {
      // parse and loop through the records in the datatable
      $('someName', xml).each(function() {
      // your this pointer actually is a record in your datable
      $(this).find('ColumnName').text();
      });
      },
      error: function(err) {
      // do your jQuery error handling here
      }
      });

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups