javascript - display data from database in angularjs and json -


i trying display data database in angularjs using webservice geting error[object object] while retriving data

my web method is:

<webmethod()> _ <scriptmethod(responseformat:=responseformat.json)> _ public function getdata() string     dim strcon sqlconnection = new sqlconnection("data source=pc12\sql2;initial catalog=testdata;user id=abc;password=xxxx; timeout=0;")     dim dt datatable = new datatable     dim da sqldataadapter     dim cmd sqlcommand = new sqlcommand("select * user", strcon)     strcon.open()     da = new sqldataadapter(cmd)     da.fill(dt)     dim serializer new system.web.script.serialization.javascriptserializer()     dim rows new list(of dictionary(of string, object))()     dim row dictionary(of string, object)     each dr datarow in dt.rows         row = new dictionary(of string, object)()         each col datacolumn in dt.columns             row.add(col.columnname, dr(col))         next         rows.add(row)     next     return serializer.serialize(rows) end function 

my javascript call webservice:-

$(document).ready(function () {         $.ajax({             type: 'post',             url: 'webservice1.asmx/getdata',             data: '{}',             contenttype: 'application/json; charset=utf-8',             datatype: 'json',             success: function (data) {                 alert("result: " + data);             },             error: function (xmlhttprequest, textstatus, errorthrown) {                 alert("error: " + errorthrown + xmlhttprequest + textstatus);             }         });     }); 

got solution

i haven't added attribute in web service.

only web services attribute on class definition can called script.

after adding got data.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -