Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#cboPais").change(function () {
- var params = new Object();
- params.pais = $("#cboPais").val();
- params = JSON.stringify(params);
- $.ajax({
- type: "POST",
- url: "SociosRed.aspx/GetDepartamentosByPais",
- data: params,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false,
- success: function(LoadDepartamento){
- console.log(LoadDepartamento);},
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- alert(textStatus + ": " + XMLHttpRequest.responseText);
- }
- });
- });
- function LoadDepartamento(result) {
- $("#cboDepartamento").html("");
- $.each(result.d, function () {
- $("#cboDepartamento").append($("<option></option>").attr("value", this.Codigo).text(this.Nombre))
- });}
- <asp:DropDownList ID="ddlContinents" runat="server" AppendDataBoundItems="true"
- onchange = "PopulateContinents();">
- <asp:ListItem Text = "Please select" Value = "0"></asp:ListItem>
- </asp:DropDownList>
- [System.Web.Services.WebMethod]
- public static ArrayList PopulateCountries(int continentId)
- {
- //codigo
- }
- $.ajax({
- type: "POST",
- url: pageUrl + '/PopulateCountries',
- data: '{continentId: ' + $('#<%=ddlContinents.ClientID%>').val() + '}',
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: OnCountriesPopulated,
- failure: function(response) {
- alert(response.d);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement