Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. $("#cboPais").change(function () {
  2.  
  3. var params = new Object();
  4. params.pais = $("#cboPais").val();
  5. params = JSON.stringify(params);
  6.  
  7. $.ajax({
  8. type: "POST",
  9. url: "SociosRed.aspx/GetDepartamentosByPais",
  10. data: params,
  11. contentType: "application/json; charset=utf-8",
  12. dataType: "json",
  13. async: false,
  14. success: function(LoadDepartamento){
  15. console.log(LoadDepartamento);},
  16. error: function (XMLHttpRequest, textStatus, errorThrown) {
  17. alert(textStatus + ": " + XMLHttpRequest.responseText);
  18. }
  19. });
  20.  
  21. });
  22.  
  23. function LoadDepartamento(result) {
  24.  
  25. $("#cboDepartamento").html("");
  26.  
  27.  
  28. $.each(result.d, function () {
  29. $("#cboDepartamento").append($("<option></option>").attr("value", this.Codigo).text(this.Nombre))
  30.  
  31. });}
  32.  
  33. <asp:DropDownList ID="ddlContinents" runat="server" AppendDataBoundItems="true"
  34. onchange = "PopulateContinents();">
  35. <asp:ListItem Text = "Please select" Value = "0"></asp:ListItem>
  36. </asp:DropDownList>
  37.  
  38. [System.Web.Services.WebMethod]
  39. public static ArrayList PopulateCountries(int continentId)
  40. {
  41. //codigo
  42. }
  43.  
  44. $.ajax({
  45. type: "POST",
  46. url: pageUrl + '/PopulateCountries',
  47. data: '{continentId: ' + $('#<%=ddlContinents.ClientID%>').val() + '}',
  48. contentType: "application/json; charset=utf-8",
  49. dataType: "json",
  50. success: OnCountriesPopulated,
  51. failure: function(response) {
  52. alert(response.d);
  53. }
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement