drop down list on change asp.net mvc?

maito

New member
I have this drop down list that I need to add functionality, so when a new product is selected it will change the price in a text box, without doing a full page postback of course.

I have this code in now


<%=Html.DropDownList("JetPak1SelectList")%>
<%=Html.TextBox("JP1Price", Model.JP1Price)%>

<script type="text/javascript">


$("#JetPak1SelectList").change(function(){
$("#JetPak1SelectList option:selected").each(function(){
$.getJSON("~/SpaOrder/JsonComponentUpdate/"$(this)[0].value,null,function(data){
$("JP1Price")[0].value = data.price;
});
});
});

</script>


when I watch this in firebug it never gets the the script at all when I change something in the drop down list. Am i doing this correctly? Or is there a better way?
 
Back
Top