vendredi 30 octobre 2015

Why isn't a change event raised when I use jQuery in an MVC project?

I use jQuery file in my project after that change event not raise and the error raise is "$ul is not defined"

$(function () {
  $("#cou1").change(
    function () {
      alert('ok');                         
      var shaId = $("#cou1 option:selected").text();
      alert(shaId);
      $("#txtc").val(shaId);

      $.ajax(
        {
          url: "/State/GetStates",
          data: { shaId: shaId },
          success: function (value) {
            cities = JSON.parse(value);
            $("#cou2").html("");
            $("#cou2").append("<option>--- Please select ---</option>")
            $.each(cities, function (idx, city) {                          
              $("#cou2").append("<option value='" + city.Id + "'>" + city.name + "</option>")

Aucun commentaire:

Enregistrer un commentaire