Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Webservice method call
    primarykey
    data
    text
    <p>I'm new to Jquery and Ajax. I'm making a call to the web service and getting an XML data as output. I would like to convert the XML data into an array so that i can bind this data with the AJAX GRIDVIEW. I have posted the js code, result from the webmethod and required result. Any way to convert the XML to array. Thanks for your help. </p> <p>The JS code is:</p> <pre><code>var jsonText = $.toJSON(subc); $.ajax( { type: "POST", url: "frmFeesCollection.aspx/ServerSideMethod", data: "{paraml: '" + jsonText + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, success:function(result) { var gridView = $find('&lt;%= grdpopup.ClientID %&gt;'); //Converting of XML to array here var data = new Array(); gridView.set_dataSource(data); gridView.dataBind(); }, error: function(err) { alert('Error:' + err.responseText + ' Status: ' + err.status); } }); </code></pre> <p>The result from the webservice looks like this:</p> <pre><code>&lt;NewDataSet&gt; &lt;Table&gt; &lt;SUBCAT&gt;1&lt;/SUBCAT&gt; &lt;PENDF&gt;1&lt;/PENDF&gt; &lt;PAIDM&gt;1000.00&lt;/PAIDM&gt; &lt;/Table&gt; &lt;Table&gt; &lt;SUBCAT&gt;1&lt;/SUBCAT&gt; &lt;PENDF&gt;1&lt;/PENDF&gt; &lt;PAIDM&gt;5000.00&lt;/PAIDM&gt; &lt;/Table&gt; &lt;Table&gt; &lt;SUBCAT&gt;6&lt;/SUBCAT&gt; &lt;PENDF&gt;1&lt;/PENDF&gt; &lt;PAIDM&gt;1000.00&lt;/PAIDM&gt; &lt;/Table&gt; &lt;Table&gt; &lt;SUBCAT&gt;6&lt;/SUBCAT&gt; &lt;PENDF&gt;1&lt;/PENDF&gt; &lt;PAIDM&gt;6000.00&lt;/PAIDM&gt; &lt;/Table&gt; &lt;/NewDataSet&gt; </code></pre> <p>The required array would be something like this:</p> <pre><code>data[0] = { SUBCAT: 1, PENDF: 1,PENDM: 1000.00}; data[1] = { SUBCAT: 1, PENDF: 1,PENDM: 5000.00}; data[2] = { SUBCAT: 6, PENDF: 1,PENDM: 1000.00 }; data[3] = { SUBCAT: 1, PENDF: 1,PENDM: 6000.00}; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload