注意,代码工作在我的机器上正常,但在发布到我的托管服务提供商隐藏的数据没有被公布asp.net MVC3 JQuery的隐藏字段没有被张贴
我有你设置地址的形式,谷歌地图则得到纬度/经度和jQuery将在隐藏字段设置的值
但发布时的数值不会发送到服务器
我甚至尝试请求[“纬度”]并没有被送到
当运行相同的代码o ñ我的本地机器工作正常,可能是一个配置问题?我没看到它。
感谢
这里是在这一点上的代码 网页
...
@using (Html.BeginForm("Register","Account")) // same error without the action and controller specified
....
@Html.TextBoxFor(m => m.Address, new { maxlength = "200" })
.....
@Html.HiddenFor(m => m.Lat)
@Html.HiddenFor(m => m.Lng)
....
在JS
...
$('#Address').blur(function() {
$('#Address').val($('#Address').val().toUpperCase());
codeAddress();
drawCircle();
});
...
function codeAddress() {
if ($('#Address').val() == '')
return;
var address = $('#Address').val() + ', CA';
if (geocoder) {
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
$('#Lat').val(results[0].geometry.location.lat());
$('#Lng').val(results[0].geometry.location.lng());
//alert($('#Lat').val() + ', ' +$('#Lng').val())
map.setCenter(results[0].geometry.location);
drawCircle();
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
....
的一部分警报显示新的纬度,经度
发布时空的默认值为0
我的问题是为什么它总是在我的开发机器上工作,而不是在我的共享主机上工作?
更新:它似乎像defaultbinder没有约束力,为什么它会在本地工作,但不在活服务器上?
新更新: 其实形式被公布,我可以在Firebug 看到我的控制器说,没有收到表格数据虽然 我的日志中提示没有发布数据
它也发生在日志上,在那里只有用户名,密码,记得我被送到 任何想法将有助于
@Html.ValidationSummary(true, @sResources.Strings.LogOnUnsuccessful)
@using (Html.BeginForm("LogOn", "Account"))
{
<div>
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
@Html.LabelFor(m => m.UserName)
</div>
<div class="editor-field">
@Html.TextBoxFor(m => m.UserName, new { style = " width:200px" })
@Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Password)
</div>
<div class="editor-field">
@Html.PasswordFor(m => m.Password, new { style = " width:200px" })
@Html.ValidationMessageFor(m => m.Password)
</div>
<div class="editor-label">
@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe)
</div>
<p>
<input type="submit" value="@sResources.Strings.LogOn" />
</p>
</fieldset>
</div>
}
[HttpGet]
public ActionResult LogOn()
{
return View();
}
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
//LogOnModel model = new LogOnModel() { UserName = UserName, Password = Password, RememberMe = RememberMe.HasValue ? RememberMe.Value : false };
if (model != null)
Log(new Exception(string.Format("model username : {0}, password : {1}, request[username] {2} , request[password] : {3}", model.UserName, model.Password, Request["UserName"], Request["Password"])));
try...
其中model.UserName和model.Password是空
为什么模型是空的
_请向我们展示您的code_。 – SLaks
*可能*有什么错误的路径 – Rafay