I have a ASP.NET MVC3 application that gets a List of Coordinates from a WCF service. This service returns a List with a few properties (Xcoor and Ycoor).
public List<Location> GetCoordinate()
{
sensor = new Location();
List<Location> coordinateList = sensor.GetSensorInformation();
return coordinateList;
}
In my web Page, I have a JavaScript function that takes 2 parameters and displays coordinates on the page (on a map)
function GetLocation(y, x){
//my code here
}
I want to get the list of coordiates from my controller and pass them in to that JS function for processing.
What is the best way to go about this?
I tries using the following but I dont know how to parse the results
$.ajax({
url: '@Url.Action("GetCoordinate")',
type: 'GET',
dataType: 'xml',
success: function(result) {
},
error: function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);}
});
Any ideas?
GetCoordinatesArray
returns a List<T> how exactly will jQuery's$.ajax
invoke that as a URL?