I think you are doing it wrong. You have a controller action with decimal? NRB as a parameter which you are not passing value to from your ajax call but you setting that variable and then trying to some how use it.
I think you could have your controller as shown below:
public JsonResult GetTransactionBuyingRate(int? eventIdB, decimal? NRB)
{
var currFrom = db.Currencys.Where(u = > u.CurrencyId == eventIdB).First();
return Json(currFrom.Buying_Rate, JsonRequestBehavior.AllowGet);
}
<script type="text/javascript">
function GetTransactionBuyingRate() {
var eventIdB = document.getElementById("CurrencyId").value;
$.ajax({
url: '@Url.Action("GetTransactionBuyingRate", "Transaction")',
type: 'GET',
data: {
eventIdB: eventIdB
},
cache: false,
success: function(result) {
alert(result);
$('#Transaction_Rate').val(result);
}
});
}
</script>
Also would suggest you to open your Dev tools (f12) and check for errors if any and network calls.