I want if else condition between two label on dropdown change event, if both have same value then alert message otherwise qty meet else wrong
<script type="text/javascript">
$(document).ready(function () {
$("#select2-1").change(function () {
//console.log($("#select2-1").val());
var orderId = $("#select2-1").val();
if (orderId != "") {
GetOrderno(orderId);
GetProduceqty(orderId);
GetPackedqty(orderId);
GetOrdernoID(orderId);
}
else {
$("#quantity-label-2").text("QTY");
$("#orderqty").empty();
}
});
});
function GetOrderno(orderId) {
$.ajax({
async: true,
type: 'GET',
dataType: 'JSON',
url: '/OrderPack/GetOrderno',
data: { orderId: orderId },
success: function (data) {
console.log(data);
//populate the didden field
$("#orderqty").val(data.orderqty);
//populate the label
$("#quantity-label-2").text(data.orderqty);
},
error: function () {
alert("There is some problem to get.");
}
});
}
function GetProduceqty(orderId) {
$.ajax({
async: true,
type: 'GET',
dataType: 'JSON',
url: '/OrderPack/GetProduceqty',
data: { orderId: orderId },
success: function (data) {
console.log(data);
//populate the didden field
$("#prdqty").val(data.prdqty);
//populate the label
$("#quantity-label-3").text(data.prdqty);
},
error: function () {
alert("There is some problem to get.");
}
});
}
function GetPackedqty(orderId) {
$.ajax({
async: true,
type: 'GET',
dataType: 'JSON',
url: '/OrderPack/GetPackedqty',
data: { orderId: orderId },
success: function (data) {
console.log(data);
//populate the didden field
$("#packQty").val(data.packQty);
//populate the label
$("#quantity-label-4").text(data.packQty);
},
error: function () {
alert("There is some problem to get.");
}
});
}
function GetOrdernoID(orderId) {
$.ajax({
async: true,
type: 'GET',
dataType: 'JSON',
url: '/OrderPack/GetOrdernoID',
data: { orderId: orderId },
success: function (data) {
console.log(data);
//populate the didden field
$("#Orderno").val(data.OrderNo);
//populate the label
$("#Orderno-label-5").text(data.OrderNo);
},
error: function () {
alert("There is some problem to get.");
}
});
}
@Html.LabelFor(model => model.OrderNo, "Select Order", htmlAttributes: new { @class = "control-label col-md-3" })
@Html.DropDownList("orderId", (SelectList)ViewBag.OrderNo, "Select", htmlAttributes: new { @class = "form-control", @id = "select2-1" })
@Html.ValidationMessageFor(model => model.OrderNo, "", new { @class = "text-danger" })
</div>
<div class="col-md-4" style="background-color:lightskyblue; text-align:center;font-family:'Times New Roman'">
<h3 style="font-family:'Times New Roman'">Order Status</h3>
@Html.LabelFor(model => model.orderqty, "Order", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.LabelFor(model => model.prdqty, "Produce", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.LabelFor(model => model.packQty, "Packed", htmlAttributes: new { @class = "control-label col-md-2" })
<br />
@Html.LabelFor(model => model.orderqty, "Order", htmlAttributes: new { @class = "control-label col-md-2", @id = "quantity-label-2" })
@Html.HiddenFor(Model => Model.orderqty)
@Html.LabelFor(model => model.prdqty, "Produce", htmlAttributes: new { @class = "control-label col-md-2", @id = "quantity-label-3" })
@Html.HiddenFor(Model => Model.prdqty)