0

can any one help me how to pass model object from view to controller using ajax .i have below code but not working.i am getting null in EmpAddType .even i selected any thing from drop downlist

<script>  

    function GetFilter() {  

        var employeeAddress = {  
            "EmpAddType": $("#drop1 option:selected").text()  

        }  

        alert($("#drop1 option:selected").text());  
        alert(employeeAddress.EmpAddType);  

        $.ajax({  
            url: '@Url.Action("SaveAddress")',  
            type: 'POST',  
            cache: false,  
            contentType: 'application/json',  
            dataType: "json",  

            data: JSON.stringify(employeeAddress),  
            success: function (data) {  
                alert("You Multiple Data Passed Successfully");  
            },  

            error: function () {  
                alert("failed");  
            }  
        });  

    }  
    function showDiv() {  

        $('#MailingContactDetails').show(1000)  
    }  
    function showDiv2() {  

        $('#AccountDetail').show(1000)  
    }  

</script>  
1
Contributor
0
Replies
9
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.