Eswar Datta

Eswar Datta

  • 1.8k
  • 115
  • 3.1k

Web services and jquery ajax

Dec 26 2018 1:06 AM
[WebMethod]
public void Getcountries()
{
List<oCountries> countries = new List<oCountries>();
SqlConnection con = new SqlConnection(constr);
SqlCommand command = new SqlCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "RETRIEVE_DATA";
command.Connection = con;
con.Open();
SqlDataReader sdr = command.ExecuteReader();
while (sdr.Read())
{
oCountries countriesS = new oCountries();
countriesS.CID = Convert.ToInt16(sdr["CTRY_ID"]);
countriesS.CName = sdr["CRTY_NAME"].ToString();
countries.Add(countriesS);
}
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(countries));
}
 
 
 
 
How to bind this data to dropdown list using jquery ajax 

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (1)