我有一個asp.net mvc應用程序。我有一個名為“ Access”的視圖,控制器,我正試圖在ajax中調用controllers方法之一。而且我遇到了語法錯誤。根本沒有調用方法測試控制器方法代碼:[HttpGet]public JsonResult Test(string p){ return Json(new User() { Name="Nat"}, JsonRequestBehavior.AllowGet);}ajax呼叫:$.ajax({ type: "GET", url: "Access/Test", // the method we are calling contentType: "application/json; charset=utf-8", data: { "p": "test" }, dataType: "json", success: function (result) { alert("yes"); alert('Yay! It worked!' + result); }, error: function (request, status, error) { alert('Not worked ' + error); }});這是一個非常簡單的代碼,但是我不能強迫它正常工作。我想了解為什么我的json數據不正確并且出現錯誤。我想執行我的方法
阿賈克斯 語法錯誤。無效字符
江戶川亂折騰
2021-03-30 21:14:28