function update_transfer(){
//alert("up");
url = "/main/ajax_select_transfer?r=" + Math.round(Math.random()*1000) + "&from=" + $("select#origin").val();
$.ajax({
url: url,
cache: false,
dataType: "json",
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus + ":" + url);
},
success: function(j) {
var options = '';
for (var i = 0; i < j.length; i++) {
options += "";
}
$("select#destination").html(options);
}});
}
$(document).ready(function(){
$("#transferForm").validate ( {
rules: {
origin: {
required: true,
number: true
},
destination: {
required: true,
number: true
},
day: {
required: true,
number: true
},
hora: {
required: true,
number: true
},
minutos: {
required: true,
number: true
},
people: {
required: true,
number: true
}
},
messages: {
origin: "Please select an Origin.",
destination: "Please select a Destination.",
day: "Please select a day.",
hora: "Please select an hour.",
minutos: "Please select minutes.",
people: "Please select a number of People."
},
errorContainer: "#warning, #messageBox2",
errorLabelContainer: "#warning ul",
wrapper: "li"
});
$("select#origin").change(update_transfer);
//update_transfer();
})