in MVC-Anwendung gesendet, i Dropdown-Liste verwenden, indem Sie JavaScript und Json,Wie DropDown verwenden, um Daten
hier ist das Skript:
//load List
$(document).ready(function() {
$.getJSON("/home/getProfiliList", function (data) {
$.each(data, function (i, data) {
$('<option>',
{
value: data.prof_cena,
text: data.prof_ime
}).html(data.prof_ime).appendTo("#profilID");
});
})
//load price
$(function() {
$("[name='profilID']").on("change", function() {
$("#pr_cena").val($(this).val());
});
});
});
jetzt, wenn ich Form zur Datenbank zu diesem Zeitpunkt senden speichern als Wert des Preises. Auch ich brauche Wert des Preises, weil, wenn sich etwas vom Listenpreis automatisch entscheidet.
Wie mit diesem Skript möglich ist profilID als Text zu senden, um dieses Skript enthalten
hier ist der Code von DropDown:
<select name="profilID" id="profilID">
<option value="">- LIST -</option>
</select>