Trying to Get Data using Ajax call to Controller method MVC My code Attached

前端 未结 2 1506
北恋
北恋 2021-01-28 18:23

I am calling jquery function on dropdown value change jquery method is ,

function MyFunction() {
    alert($(\'#DDlSurvey\').val());
    $.ajax({
        url: \"         


        
2条回答
  •  我在风中等你
    2021-01-28 18:58

    I think you are using controller name straight forward. your ajax code be something like this.

    var PostData= { prefix: $('#DDlSurvey').val() }
    var ajaxOptions = {
            type: "GET",
            url: '@Url.Action("GetSelectedQuestion", "ConductSurvey")',//Actionname, ControllerName
            data: PostData,
            dataType: "json",
            success: function (result) {
                console.log(result);
            },
            error: function (result) {
    
            }
    };
    $.ajax(ajaxOptions);
    

提交回复
热议问题