I need to implement a way to invoke the method GetAccount
from my controller AccountController.cs
within my JavaScript factory LoginFactory.js
. Here is an example of what I am trying to achieve:
AccountController.cs:
public Account GetAccount(string userName)
{ ... }
LoginFactory.js:
if(x>y) {
var account = <%AccountController.GetAccount(someParam);%>
}
I have attempted using [WebMethod]
and Ajax, however, I have been unable to make it work as I keep receiving a 404 error response.