I tried draw route of click truck marker on google map.But I get this eror "Internal Server Error"
Javascript codes :
function Route(Param)
{
$.ajax({
type: "POST",
url: "Mainpage.aspx/Route",
data: '{"data":"' + Param+ '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
if (msg.d) {
alert(msg.d);
}
else {
alert("Error...");
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
});
//Click truck marker
// call and set parameter Route function
Route(parseInt(dataTruck.TruckId));
Code behind
Mainpage.aspx.cs
static string _Route;
[WebMethod]
public static string Route (int TruckId)
{
_Route = _DrawRoute(TruckId);
return _Route ;
}
public static string _DrawRoute(int TruckId)
{
// return Serialize rows
}
Route method return this format :
[{"Lat":37.9137,"Lng":28.3708},{"Lat":37.9138,"Lng":28.3707},{"Lat":37.9137,"Lng":28.3709},{"Lat":37.9138,"Lng":28.3708}]