0

我正在尝试对我的控制器进行 Ajax 调用并传回一个字符串......由于某种原因,我无法进入我的控制器......不知道我错过了什么......

$.ajax({
                url: dummyURL,
                success: function (result) {
                    $('#resultDiv').append('<b>' + result + '</b>');
                    setTimeout(function () {
                        window.location = RedirectUrl;
                    }, 1000);
                }
            });

这就是我设置我的 url 字符串的方式:

var dummyURL = '@Url.Action("AddPatient", "AddFoundPatient", new { FirstName = "-1", LastName = "-2", DOB = "-3", MRN = "-4", EMPIID = "-5", popID = (int)TempData["POPULATIONID"] })';

var FName = rowData['First_Name'];
            var LName = rowData['Last_Name'];
            var DOB = rowData['DOB'];
            var MRN = rowData['medipacId'];
            var EMPIID = rowData['EMPIID'];
            //Add Patient call
            var path = dummyURL.replace("-1", FName);
            path = path.replace("-2", LName);
            path = path.replace("-3", DOB);
            path = path.replace("-4", MRN);
            path = path.replace("-5", EMPIID);

这是我试图调用的 Action 方法......

public string AddFoundPatient(string FirstName, string LastName, string DOB, string MRN, string EMPIID, int popID)

这是我生成的查询字符串...

/AddFoundPatient/AddPatient?FirstName=BETTY &amp;LastName=WHITE &amp;DOB=1925-10-25 &amp;MRN=840108105 &amp;EMPIID=11011833 &amp;popID=2

我从来没有在我的操作中遇到调试语句......我做错了什么?

4

1 回答 1

3

控制器和动作混淆了

var dummyURL = '@Url.Action("AddFoundPatient", "AddPatient", new { FirstName = "-1", LastName = "-2", DOB = "-3", MRN = "-4", EMPIID = "-5", popID = (int)TempData["POPULATIONID"] })';
于 2012-07-25T21:31:37.860 回答