I have ajax code for asp.net (non-mvc) to call webMethod to get additional data from the server for the request. But I canβt understand what the URL is for my jQuery in MVC.
<script type="text/javascript" language="javascript"> function SubmitAjax(url, message, successFunc, errorFunc) { $.ajax({ type:"POST", url:url, data:message, contentType: "application/json; charset=utf-8", dataType: "json", success:successFunc, error:errorFunc }); };
I do not want to transfer the entire list of related data to the selection list for each person who comes to the page, because not everyone needs it. Therefore, I would like to call a controller or web method via jQuery, but I cannot figure out how to address the URL in MVC.
I noticed this post: jQuery Ajax call is allowed for the current controller folder, instead of the root folder
is the $ .getJson and mvc method? Is this a good solution for my use case? I need only return a string url or an empty string if what I am looking for is not found. Do I need to include the $ .getJSon method? is part of MVC or part of jQuery? Is the leading slash an indication of the root of the application or the root of the server?
jquery c # asp.net-mvc
Maslow
source share