javascript - html dropdown menu change dynamically -


i have following code. have 2 select option menu. every time of them changed, want send ajax request servlet. using data comes servlet, want write in html.

how can that?

thanks

<div class="p_inforoom">     <input type="hidden" th:value="${hoteldetail.deal.id}" id="dealid" />       <h3>oda bilgileri :<b th:text="${hoteldetail.deal.room.name}"></b></h3>     <select name="numberofnights" id="night" onchange="getnights(this)">         <option  th:each="rooms:${roomsleft}" th:text="${rooms}" th:value="${rooms}" id="roomleft" > </option>      </select>     <select name="roomtype" id="room" onchange="getrooms()">         <option class="1" value="1" >tek kişilik</option>         <option class="2" selected="selected" value="2" >Çift kişilik</option>     </select> </div> 

you can use following select change:

$( "#room" ).change(function() { alert( "handler .change() called." ); }); 

source .change

for ajax query can info at: ajax. below can find 1 example page.

$.ajax({     type: "post",     url: "some.php",     data: { name: "john", location: "boston" } }).done(function( msg ) {    alert( "data saved: " + msg ); }) 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -