Sending Data From Controller To Javascript Using Linq 500 Internal Server Error Mvc2
C# public ActionResult SimpleQuery() { ClientDataContext dc = new ClientDataContext(); var userResults = from u in dc.TS_Trucks select u; return Json(userResults
Solution 1:
you need to specify the controller for your url helper. The server error is from trying to locate your action. Try this for the ajax url:
'@Url.Action("SimpleQuery", "<ControllerForYourActionHere>")'
Solution 2:
Internal Error usually infers bad URL address.
In this case, url parameter is not set to right value.
First, you need to check which Router map to this function: SimpleQuery
Then, use that address to fill in url parameter.
Also, I don't think '@Url.Action("SimpleQuery", "<ControllerForYourActionHere>")'
will work if you put
it in javascript file. It might works in cshtml file.
So, the conclusion is when you are doing frontend programming, use absolute link will be a good idea.
It make sure you hit the right address at the first time.
Post a Comment for "Sending Data From Controller To Javascript Using Linq 500 Internal Server Error Mvc2"