0

I am serializing a form with jquery:

$(document).on("click", "#btnsubmit", function () {
  $.ajax({
    url: "/Home/RiskScore",
    type: "post",
    data: $("form").serialize(),
    success: function (result) {
        $('.content-wrap').html(result);
    }
  });
});

And one of my textboxes is BMI and counts the bmi out of two other textboxes. I don't want anyone to be able to change the value of the textbox and thats why i have disabled it. The problem is that when it is disabled the serializing method above works but it can't find the BMI textbox and its value.

4

2 回答 2

0

一个解决方案是使用 BMI 隐藏一个值,这样它将被序列化拾取。

此外,如果您想显示该值,您可以简单地将其显示为<div>or<span>或仅作为字符串显示。

于 2013-07-24T15:57:33.353 回答
0

我的解决方案:)

$(document).on("click", "#btnsubmit", function () {
$("#PersonBMI").removeAttr('disabled');
$.ajax({
    url: "/Home/RiskScore",
    type: "post",
    data: $("form").serialize(),
    success: function (result) {
        $('.content-wrap').html(result);
    }
});

});

于 2013-07-25T06:52:44.603 回答