Schleid Alex

Schleid Alex

  • 1.6k
  • 361
  • 17.9k

Help me find jquery error

Apr 26 2020 2:45 PM
Hi,
 
I have this script.
 
<script>
    $(document).ready(function() {
         $('#ddlMonth').change(function () {
             var ddlMonthValue = $('#ddlMonth').val()
         })
        $('#ddlYears').change(function () {
            var ddlYearValue = $('#ddlYears').val()
            //alert('The year selected is ' + ddlYearValue)
        })
        $('#btnShowTrans').click(function () {
            alert('You made it here')
            $.ajax({
                type: 'GET',
                url: '@Url.Action("GetAccountDetailByCustomerID", "AccountTransactions")',
                contentType: 'apllication/html; charset=utf-8',
                data: {
                    'id ': @Model.CustomerID,
                    'SelectedYear ': ddlYearValue,
                    'SelectedMonth': ddlMonthValue
                },
                dataType: 'html',
                success: function (result) {
                    $('#dvAccountTransactions').html(result)
                }
            })
        })
    })
</script>
 
for some reason it keep saying ddlYearValue is not defined.
While I do have it defined, I think it is a problem with how I pass the different parameters.
 
thank you!

Answers (4)