我是jquery
的初学者。请帮我解决我的任务。
我有 选择 ,并且在行动 onfocus 上运行我的代码:
function sendBall(id){
$('#bal_'+id).blur(function(){
$.ajax({
type: "POST",
url: "<?php echo Yii::$app->createUrl("teacher/setball");?>",
data: {shedId: this.form.shedId.value, type: this.form.type.value, userId: this.form.userId.value, ball: this.form.bal.value},
error: function(){
},
beforeSend: function(){
$('select').attr('disabled');
$('#bal_'+id).unbind('focus');
},
success: function(data){
$('select').removeAttr('disabled');
}
});
});
}
我想为每个活动发送一个请求。
答案 0 :(得分:0)
$show.='<form id="theForm_' . $ruzId . $uId . '">';
$show.=CHtml::hiddenField('type', $ruzId, array('id' => 'type'));
$show.=CHtml::hiddenField('shedualId', $idShedual, array('id' => 'shedId'));
$show.=CHtml::hiddenField('userId', $groupIn, array('id' => 'userId'));
$show.=CHtml::dropDownList('bal', 'text', array(0,1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array('onfocus' => 'sendBall(' . $ruzId . $groupIn . ')','id' => 'bal_' . $ruzId . $groupIn,'empty'=>' '));
$show.=' <button type="button" class="delete classHidden" onfocus="dellBall(' . $ruzId . $groupIn . ')" id="delete_' . $ruzId . $groupIn . '">×</button>';
$show.='</form>';
$show.='</td>';