我将2个数据发布到我的控制器,其中一个是浮动的。但是当我输入值“1.5”时,我的控制器没有进入。如果我进入1,5,它就会被歪曲。我不明白为什么?
这是我的代码
<div class="input-group" style="margin-top: 8px;width:100%">
<input type="text" class="form-control input-lot" placeholder="Lot">
@*<input class="input-group-addon" value=".00 TL">*@
</div>
<div class="mgmt10">
<select name="parity" class="form-control wfl parity" style="margin-right:10px; width:251px;">
<option value="AUDCAD" selected>AUDCAD</option>
<option value="AUDCHF">AUDCHF</option>
<option value="AUDJPY">AUDJPY</option>
<option value="AUDNZD">AUDNZD</option>
<option value="AUDUSD">AUDUSD</option>
<option value="CADJPY">CADJPY</option>
<option value="CHFJPY">CHFJPY</option>
<option value="EURAUD">EURAUD</option>
<option value="EURCAD">EURCAD</option>
<option value="EURCHF">EURCHF</option>
<option value="EURGBP">EURGBP</option>
<option value="EURJPY">EURJPY</option>
<option value="EURNZD">EURNZD</option>
<option value="EURTRY">EURTRY</option>
<option value="EURUSD">EURUSD</option>
<option value="GAUTRY">GAUTRY</option>
<option value="GBPAUD">GBPAUD</option>
<option value="GBPCAD">GBPCAD</option>
<option value="GBPCHF">GBPCHF</option>
<option value="GBPJPY">GBPJPY</option>
<option value="GBPTRY">GBPTRY</option>
<option value="GBPUSD">GBPUSD</option>
<option value="NZDUSD">NZDUSD</option>
<option value="SPTTRY">SPTTRY</option>
<option value="TRYJPY">TRYJPY</option>
<option value="USDCAD">USDCAD</option>
<option value="USDCHF">USDCHF</option>
<option value="USDJPY">USDJPY</option>
<option value="USDRUB">USDRUB</option>
<option value="USDTRY">USDTRY</option>
<option value="XAGUSD">XAGUSD</option>
<option value="XAUTRY">XAUTRY</option>
<option value="XAUUSD">XAUUSD</option>
<option value="SP500H5">SP500</option>
<option value="DJ30H5">DJ30</option>
<option value="NAS100H5">NAS100</option>
<option value="DE30H5">DE30</option>
<option value="UKOILG5">BRENT OIL</option>
<option value="USOILG5">WTI OIL</option>
<option value="ZCH5">MISIR</option>
<option value="NGG5">DOĞAL GAZ</option>
<option value="ZSH5">SOYA</option>
<option value="ZWH5">BUĞDAY</option>
</select>
<div class="clr"></div>
</div>
<span class="btn mt14 fnt div-calculate" style="width:100%;" onclick="MarginCalculator()">Çevir</span>
<input type="text" class="form-control mgmt10" id="div-hesap" placeholder="Sonuç" style="margin-bottom:1px;" readonly>
</div>
<script type="text/javascript">
function MarginCalculator() {
var data = {
frmLot: $(".input-lot").val(),
frmParity: $(".parity").val(),
};
$.ajax({
url: "/tr/Tools/MarginCalculator",
type: "POST",
datatype: "json",
contentType: "application/json; charset=utf-8",
data: data,
beforeSend: function (XMLHttpRequest) {
isProcessing = true;
$("#div-hesap").val("Lütfen bekleyiniz.");
},
success: function (response) {
$("#div-hesap").val(Math.round(response) + " $ teminat gerekmektedir.");
}
});
}
</script>
答案 0 :(得分:0)
var x = $(".input-lot").val();
var res = x.replace(/\./g, ",");
但我仍然想知道为什么它没有