我在我的项目MVC上使用map。当点击按钮'过滤器'在地图上显示一些点并显示到同一页面。我也想使用另一个按钮(显示按钮)在没有布局的另一页面上显示地图。它意味着全屏地图视图。此点击按钮的事件:
<script type="text/javascript">
$("#Showbutton").click(function () {
var Desert = $("#DesertID").val();
var Type = $("#meter_TypeMeterID_FK").val();
var Usemeter = $("#meter_UseMeterID_FK").val();
var Affair = $("#meter_AffairID_FK").val();
var GroupMeter = $("#meter_GroupMeterID_FK").val();
var Status = $("#modem_StatusID_FK").val();
var StatusMeter = $("#meter_StatusID_FK").val();
$.ajax({
type: "POST",
url: '@Url.Action("ShowMapOnOtherPage", "Map")'
dataType: "JSon",
data: { "Affair": Affair, "Type": Type, "Desert": Desert, "Usemeter": Usemeter, "GroupMeter": GroupMeter, "Status": Status, "StatusMeter": StatusMeter },
success: successFunc,
error: errorFunc
});
});
单击Showbutton时,运行方法“ShowMapOnOtherPage”:
public ActionResult ShowMapOnOtherPage(string desertName, string Type, string Usemeter, string Affair, string GroupMeter, string Status, string StatusMeter)
{
//Do something
return View("~/Views/Map/ShowMapOnOtherPage.cshtml");
}
但不显示视图'ShowMapOnOtherPage.cshtml'。为什么?!
答案 0 :(得分:1)
您有创建表单
<form action="@Url.Action("ShowMapOnOtherPage", "Map")" method="post" name="mapform" id="mapform">
<input type="hidden" name="desertName" value="" id="mapdesertName"/>
<input type="hidden" name="Type" value="" id="mapType"/>
<input type="hidden" name="Usemeter" value="" id="mapUsemeter"/>
<input type="hidden" name="Affair" value="" id="mapAffair"/>
<input type="hidden" name="GroupMeter" value="" id="mapGroupMeter"/>
<input type="hidden" name="Status" value="" id="mapStatus"/>
<input type="hidden" name="StatusMeter" value="" id="mapStatusMeter"/>
</form>
<script type="text/javascript">
$("#Showbutton").click(function () {
var Desert = $("#DesertID").val();
var Type = $("#meter_TypeMeterID_FK").val();
var Usemeter = $("#meter_UseMeterID_FK").val();
var Affair = $("#meter_AffairID_FK").val();
var GroupMeter = $("#meter_GroupMeterID_FK").val();
var Status = $("#modem_StatusID_FK").val();
var StatusMeter = $("#meter_StatusID_FK").val();
$("#mapdesertName").val(Desert);
$("#mapType").val(Type);
$("#mapUsemeter").val(Usemeter);
$("#mapAffair").val(Affair) ;
$("#mapGroupMeter").val(GroupMeter);
$("#mapStatus").val(Status);
$("#mapStatusMeter").val(StatusMeter);
document.mapform.submit();
});
</script>