I have a drop down that when clicked makes an ajax request to update the drop down with the latest stock levels.
When I click the drop down the request is made and the drop down gets updated and drops down with the latest data. Problem is when a user selects an option the Click ajax request is made again stoping an option from being selected.
I did try unBinding the Click function which did work but I could'nt then re bind the click in case a user wanted to change what they selected.
DropDown
<select name="Qty" id="88" class="ProQty">
<option value="0">Qty</option>
...
</select>
jQuery
//Update Qty Levels Automatically
$(function QtyCheck() {
$("select.ProQty").click(function() {
var ProductID = $(this).attr('id');
var Startdd = $("#Startdd").val();
var Startmm = $("#Startmm").val();
var Startyy = $("#Startyy").val();
var StartHours = $("#StartHours").val();
var StartMinutes = $("#StartMinutes").val();
var Enddd = $("#Enddd").val();
var Endmm = $("#Endmm").val();
var Endyy = $("#Endyy").val();
var EndHours = $("#EndHours").val();
var EndMinutes = $("#EndMinutes").val();
var dataString = 'Startdd=' + Startdd + '& Startmm=' + Startmm + '& Startyy=' + Startyy + '& StartHours=' + StartHours + '& StartMinutes=' + StartMinutes + '& Enddd=' + Enddd + '& Endmm=' + Endmm + '& Endyy=' + Endyy + '& EndHours=' + EndHours + '& EndMinutes=' + EndMinutes;
$("#" + ProductID).empty();
//$("#" + ProductID).empty().unbind();
$.ajax({
type: "POST",
url: "./ajax/QtyCheck.asp?ID=" + ProductID,
data: dataString,
cache: false,
success: function(html) {
//setTimeout(function() {
$("#" + ProductID).append(html);
//},600);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
//setTimeout(function() {
$("#" + ProductID).append(XMLHttpRequest.responseText);
//},600);
}
});
});
});