-1

In the view I am getting the JSON data from the controller. Path is working in my local but not working in the other servers.

$.get('../TestController/GetTestResultById?Id=' + s.GetValue(), function (data) { some data }

It is in this format I am getting the data in local but in different server the path should be appname/controllername/.... but getting as controllername/.... How to resolve this issue.

Sri K
  • 1
  • 1

1 Answers1

-1
var myUrl = '@Url.Action("GetTestResultById","Test")';
//It will create your url where you want to call ajax.


//then append Id with url and your value.
$.get(myUrl + "?Id=" + s.GetValue(), function (data) { 
    // Use `data` here
});
Saurin
  • 1,650
  • 1
  • 10
  • 8