Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

how to call [WebMethod] return DataTable by JSON jQuery

$
0
0

Hello,

I hope yourselves to answer my questions:

Q1: I create a [WebMethod] return DataTable, how can I call it from JSON jQuery?

Q2: how can I passing paramater to method in WebService,?
Ex: If I have two DropDownList, first one for Country, Second one for city, onchange() on DropDownList Country, send ID of selected Country to "getCity(int country_ID)" method, how can I do this?

Q3: If I have a function return void, and I try this:  

public void getCity(int country_id)

{

.   .   .

.   .   .

.   .   .

List<City> City_List = new List<City>();

SqlDataReader dr = cmd.ExecuteReader();

while(dr.Read())

{

City C1 = new City();

C1.ID = Convert.ToInt32(dr["ID"]);

C1.Name = dr["Name"].ToString();

C1.Country_ID = Convert.ToInt32(dr["Country_ID"]);

City_List.Add(C1);

}

JavaScriptSerialize Js = new JavaScriptSerialize();

Context.Response.Write(Js.Serialize(City_List));

}



............................... how can I get this JSON values in jQuery by call this method or function and how can I pass paramater (country_id) from selected dropDownList????


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>