단추가 정해진 시간에 클릭되지 않았는지 알 수있는 방법이 있습니까? Ajax 요청으로 온도를 제어하는 두 개의 증가 및 감소 버튼 (+ 및 -)이 있습니다. 값은 다음 함수로 1 대 1로 증가합니다.버튼이 정해진 시간에 클릭되지 않았는지 알 수있는 방법이 있습니까?
Plugin_increment.prototype.startPluginTempe = function (selector, dataAux, dataAux2, varAux, varAux2) {
var valueElement = $(selector);
function incrementValue(e){
if((valueElement.text() < 40) && (valueElement.text() > 10)){ //max and min
valueElement.text(Math.max(parseInt(valueElement.text()) + e.data.increment));
}
if(valueElement.text() == 40){//max
if(e.data.increment == -1){
valueElement.text(Math.max(parseInt(valueElement.text()) + e.data.increment));
}
}
if(valueElement.text() == 10){//min
if(e.data.increment == 1){
valueElement.text(Math.max(parseInt(valueElement.text()) + e.data.increment));
}
}
//Ajax request??????
return false;
}
$(varAux).button({
icons: {
primary: "ui-icon-plusthick"
},
text: false
}).bind('click', {increment: 1}, incrementValue);
$(varAux2).button({
icons: {
primary: "ui-icon-minusthick"
},
text: false
}).bind('click', {increment: -1}, incrementValue);
};
"selector"는 값을 표시 할 범위를 선택합니다. "varAux"및 "varAux2"는 더하기 및 빼기 버튼의 선택 자입니다.
각 증가분에 대해 Ajax 요청을 보내면 클라이언트에 과부하가 걸립니다. 단추가 결정된 시간에 클릭되지 않았는지 알 수있는 옵션이 있다고 생각합니다. 또 다른 방법?
나는 플러스와 마이너스 버튼에 jquery-ui를 사용합니다.
아약스 요청이 완료 될 때까지 버튼을 비활성화하지 않는 이유는 무엇입니까? –
5 단위체의 값을 증가 시키려면 증분이 일대일로 이루어지기 때문에. 다섯 개의 Ajax 요청이있을 것입니다. 불필요한 요청이있을 것입니다 – vicenrele