Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Failed to load resource: the server responded with a status of 404 (Not Found)

$
0
0

Hi,

I am having 2 dropdownlist in my view. First one I am filling on load and second one i am trying to fill on selected index change of first one using jquery ajax call. but I am gettin the following error always and its not at all hitting the action method.

Failed to load resource: the server responded with a status of 404 (Not Found)

Controller action to be called to fill the second ddl

public ActionResult FillBranch(Guid DistributorId)
        {
            var branchList = _masterListProvider.GetBranchList(DistributorId).ToList();            
            var result = branchList.ToList();            
            return Json(result, JsonRequestBehavior.AllowGet);
        }

My JS file which triggers on selected index change of the fist ddl and trying to fill the second ddl using jquery ajax call

$('#distributor-list').change(function () {
        var selectedindex = $("#distributor-list")[0].selectedIndex;
        debugger;
        if (selectedindex > 0) {$("#branch-list").attr('disabled', false);
            var distributorId = $(this).val();$.ajax({
                url: '@Url.Action("FillBranch", "Registration")',
                type: "POST",
                data: { 'DistributorId': distributorId },
                dataType: "json",
                traditional: true,
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    alert('success');
                },
                error: function () {
                    alert("An error has occured!!!");
                }
            });
        }
    });

But its always giving the mentioned error and not at all hitting the action.

And the second question is once i get the result from the action(after resolving the first issue) how can i append the seonc ddl with the result. The first element should be "Please Choose".

Please help me...Thanks in advance

Vidya


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>