Hi,
I have retrieve data from database using json. But i got an error like JS runtime error: Object expected
In aspx
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript">$(document).ready(function () {$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebForm1.aspx/DisplayData",
data: "{}",
dataType: "json",
success: function (data) {$("#lbltxt").text(data.d);
},
error: function (result) {
alert("Error");
}
});
});</script>
<label id="lbltxt" runat="server"></label>In aspx.cs
[System.Web.Services.WebMethod]
public static string DisplayData()
{
return DateTime.Now.ToString();
}