Google maps 如何在mvc中传递带2个值的查询字符串

Google maps 如何在mvc中传递带2个值的查询字符串,google-maps,model-view-controller,view,Google Maps,Model View Controller,View,我想在单击一行时发送两个值(经度和纬度)。因此,当我单击表中的一行时,它应该重定向到网页并在谷歌地图中显示标记。如何在查询字符串中传递动态值 代码 @型号列表 @{ ViewBag.Title=“详细信息”; Layout=“~/Views/Shared/_Layout.cshtml”; } @foreach(Model.Select(x=>x.deviceid).Distinct().ToList()中的var设备) { foreach(Model.Where中的var项(x=>x.devic

我想在单击一行时发送两个值(经度和纬度)。因此,当我单击表中的一行时,它应该重定向到网页并在谷歌地图中显示标记。如何在查询字符串中传递动态值

代码

@型号列表
@{
ViewBag.Title=“详细信息”;
Layout=“~/Views/Shared/_Layout.cshtml”;
}
@foreach(Model.Select(x=>x.deviceid).Distinct().ToList()中的var设备)
{
foreach(Model.Where中的var项(x=>x.deviceid==device)。选择((value,i)=>new{i,value}))
{
@(项目一+1)
@item.value.deviceid
@项目价值时间
@项目.价值.电池
}
}
使用javascript

$("tr").click(function() {
var tableData = $(this).children("td").map(function() {
    return $(this).text();
}).get();

 var latitude= $.trim(tableData[3]); 
 var longitude= $.trim(tableData[4]));
//3 for latitude and 4 for longitude
//then use ajax to pass parameter to function
$.ajax({
type: 'POST',
url: 'myWebForm.aspx/GetLatLong',
contentType: 'application/json; charset=utf-8',
data: { lat: latitude, long: longitude },
dataType: 'json',
success: {},
error: {}
});

//它将命中myWebForm.aspx中的GetLatLong方法。通过这个ajax调用,我们可以得到单值(lat long),表中有一堆lat long值。我需要通过查询字符串(mvc)发送所有lat long。试试这个。
$("tr").click(function() {
var tableData = $(this).children("td").map(function() {
    return $(this).text();
}).get();

 var latitude= $.trim(tableData[3]); 
 var longitude= $.trim(tableData[4]));
//3 for latitude and 4 for longitude
//then use ajax to pass parameter to function
$.ajax({
type: 'POST',
url: 'myWebForm.aspx/GetLatLong',
contentType: 'application/json; charset=utf-8',
data: { lat: latitude, long: longitude },
dataType: 'json',
success: {},
error: {}
});