Jquery Ajax success function not working

Ajax success function not working. my php page return the value but not coming into success function. I am using the following code

$(document).ready(function(){
    $('#yealysearch').click(function(){
        var year=$('#sel_year').val();
        $('#yearlydata').val('');
        $.ajax({
            type:"POST",
            url:"get_yearlyreport.php",
            data:{year},
            cache: false,
            success:function(data)
            {
                alert('sdfsdfsdf');
            },
            error: function(ts) { alert(1) }
        }); 
    });     
})

Thanks

1 answer

  • answered 2017-10-11 10:17 chibadev

    data:{year},
    

    change to :

    data:{year : year},