Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

I have an asp.net page, where i'm using jqxgrid.

To bind this grid i'm using ajax code to fetch data.
Successfully i'm get the data from the server but in ajax its throwing an error as "undefined".

ajax code:
var b = 1;
$.ajax({
                type: 'POST',
                contentType: "application/json; charset-8;",
                url: 'RJR.aspx/GetData',
                data: '{ InPutData:' + "'" + b + "'" + '}',
                success: OnSuccess,
                error: function (data) {
                        alert("Error : " + data.d);
                }

            });

                function OnSuccess(data) {
                    alert(data.d);
                    var datarow = JSON.parse(data.d);
                    var commit = $("#jqxgrid").jqxGrid('addrow', null, datarow);

            }


the function GetData() in RJR.ASPX is successfully returning xml/json as string.
but the ajax code throws an error as "undefined".

In GetData() i'm converting datatable to json/xml as per need

&

in this datatable i have date columns and numeric columns.

xml
<Root>
  <RunningJob Ticket="CS-8928" drss="1001422267" rig="SP-103" well="ABQQ-963" jobtype="9 5/8'' CSG LINER CMT JOB" 
              MobDate="11/02/2015" fromdate="11/02/2015" todate="11/03/2015" JobCost="10,907.12" Dept="CEMENTING" 
              fid="2080" Eq=" Cmt Unit 40-324, Silo 35-335, Pick Up 612" />
  <RunningJob Ticket="CS-8929" drss="1001422660" rig="SP-165" well="SDGM-263" jobtype="7'' LINER CMT JOB" 
              MobDate="11/02/2015" fromdate="11/02/2015" todate="11/03/2015" JobCost="9,625.35" Dept="CEMENTING" 
              fid="2081" Eq=" Cmt Unit 40-314, Batch Mixer 15-62, Bulker 30-302, Pick Up 622" />
  <RunningJob Ticket="CS-8948" drss="1001421627" rig="SP-163" well="RMSW-801" jobtype="18 5/8" CSG CMT HEAD" 
              MobDate="11/02/2015" fromdate="11/02/2015" todate="11/02/2015" JobCost="44,352.76" Dept="CEMENTING" 
              fid="2126" Eq=" Pump Unit 40-331, Batch Mixer 15-074, Bulker 30-334, PIick Up 658, 18 5/8" Csg Swage" />
  <RunningJob Ticket="CS-8990" drss="1001424217" rig="NBR-002" well="HRML-116" jobtype="13 3/8'' 2 STAGE CSG CMT JOB" 
              MobDate="11/02/2015" fromdate="11/02/2015" todate="11/05/2015" JobCost="22,678.92" Dept="CEMENTING" 
              fid="2213" Eq=" Cmt Unit 45-328, Silo 35-330, Silo 35-329, Pick Up 633" />
</Root>


Can anyone plz help me.


Thanks
Posted
Updated 7-Dec-15 2:34am
v4
Comments
F-ES Sitecore 7-Dec-15 8:38am    
Which line is throwing the error?
Kornfeld Eliyahu Peter 7-Dec-15 8:39am    
What is 'undefined'?
(Use the browser's debugger to find out)
abdul subhan mohammed 7-Dec-15 8:44am    
function error()
[no name] 7-Dec-15 9:17am    
Use dataType attribute in $.Ajax(..)

dataType: "json" // if you need in json
dataType: "text" // if you needin text
xszaboj 7-Dec-15 10:51am    
what is value of console.log(data)?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900