我的 javascript 似乎不喜欢var divTag = '#' + ratinglistid + " > select[name=SelectedValue] > option:selected";
我找不到答案搜索.. 很抱歉格式混乱,无法让它消失。
Script:
<script>
function doSubmit(form, myRating, ratinglistid){
var divTag = '#' + ratinglistid + " > select[name=SelectedValue] > option:selected";
var ratingValue = $(divTag);
$.ajax({
type: "GET",
url: "/RatingLists/Done",
data: ({
myrating: ratingValue,
myRatingListId: ratinglistid
}),
contentType: "application/json; charset=utf-8",
dataType: "json"
});
}
</script>
Html 我想从中获得价值:
<div id='2'>
<input type="hidden" name="RatingListId" value="2"/>
<select id="SelectedValue" name="SelectedValue" onchange="doSubmit($(this).parents('form'),2);"><option value="1">Inget intresse, tas bort</option>
<option value="2">Svagt intresse, sparas</option>
<option selected="selected" value="3">Intresserad-ingen kontakt än</option>
<option value="4">4-Intreserad-vill ha kontakt</option>
<option value="5">5-Vill byta!</option>
<option value="100">6-Avvaktar värdar</option>
</select>
</div