getJSON problem in ASP.Net
I have am trying to use getJSON() in an ASP.NET MVC 5 View:
- var controllerUrl = "@this.Url.Action(actionName:"EditData", controllerName:"Home")";
$.getJSON({ url: controllerUrl })
.done(function () {alert("getJSON succeeded"); })
.fail(function (jqXHR, textStatus, errorThrown) { debugger; alert("getJSON failed: " + textStatus); });
getJSON errors in this part of the jquery.js (version 2.1.3.). When these variables contain:
url = undefined
s.url = an object containing url: "/Home/EditData"
ajaxLocation = "http://localhost:51766/Home/EditData"
the code hits this command:
-
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
So that sets s.url to a string containing "[object Object]". And later on getJSON later tries to call a URL that ends with "object Object". Do I need to code the getJSON() command differently? Any other things to look at?