我在 AJAX 调用后遇到了获取旧值的问题。我有一个按钮可以将值保存在TextArea and DropDownBox
. 单击按钮时,它会将TextArea and DropDownBox
值controller
保存在Database
. 现在的问题是,当我第二次在这些输入字段中输入值时,我得到了一个旧值。
这是我的ajax代码:-
var pickupIssueTypeId = $("#PickupId").val(); // Here I am getting an old values
var pickupIssueNote = $("#Note").val(); // old values
$.ajax({
url: '/Orders/AddPickup',
data: postData,
dataType: "html",
type: 'POST',
traditional: true,
//cache:'false', // <---- couldn't help me
success: function (result)
{
$("#divOrderItemsContainer").html(result);
},
<table>
<tr>
<th colspan="2">
List of Items
</th>
</tr>
<tr>
<td>
Items:
</td>
<td>
<div id ="issuedItems">
</div>
</td>
</tr>
<tr>
<td>
Pickup Issue:
</td>
<td>
<%= Html.DropDownListFor(m => m.PickupId, new SelectList(Model.OrderPickupIssueTypeSelectListItems, "Value", "Text",""), new { style = "width:306px", @class = "watermark" }) %>
</td>
</tr>
<tr>
<td>
Note:
</td>
<td>
<%= Html.TextAreaFor("Note", new { style = "width:350px;height:100px;", @class = "fieldRequired watermark" }) %>
</td>
</tr>
我也尝试添加ModelState.Clear()
并没有帮助我。
TIA