I m using jquery with json webservice calling please see attached file for code..
so when i call Recordtest web method on button click ..It gives error message as "Internal server error"
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
erum mirzaPosted Dec 28, 2012, 5:39 AM
erum mirzaPosted Dec 28, 2012, 5:38 AM
using
System;using
System.Collections.Generic;using
System.Linq;using
System.Web;using
System.Data;using
System.Web.Services;using
System.Web.Script.Services;namespace
{
JQueryAjax///
/// Summary description for MyService
///[
[
[System.ComponentModel.
WebService(Namespace = "http://tempuri.org/")]WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]ToolboxItem(false)]// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.[System.Web.Script.Services.
ScriptService]public class MyService : System.Web.Services.WebService{
[
[
{
System.Threading.
}
[
[
{
}
[
[
{
WebMethod]ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string HelloWorld()Thread.Sleep(1000);return "Hello World";WebMethod]ScriptMethod(ResponseFormat = ResponseFormat.Json)] public int Add(int value1, int value2)return value1 + value2;WebMethod]ScriptMethod(ResponseFormat = ResponseFormat.Json)]public string RecordsTest(string loginid, string pass)//if (loginid == "Admin")
//{
// return "Exist";
//}
return "";//else
//{
// return "Not Exist";
//}
//DataTable dt = new DataTable("MyDataTable");
//dt.Columns.Add("column1", typeof(System.String));
//dt.Columns.Add("column2", typeof(System.String));
//DataRow dr = dt.NewRow();
//dr["column1"] = "Your Data";
//dr["column2"] = "Your Data";
//dt.Rows.Add(dr);
//dr = dt.NewRow();
//dr["column1"] = "Your Data";
//dr["column2"] = "Your Data";
//dt.Rows.Add(dr);
//return dt;}
}
}