Hello, I want to call an action each seconds.
My controller is:
class AlarmaController extends Controller
{
......
public function actionValidarTimeOutSMS(){
$val1 = $_POST['val1'];
$val2 = $_POST['val2'];
echo "something.. HELLO";
Yii::app()->end();
}
.........
}
and my view is:
<script type="text/javascript">
$(document).ready(function(){
setInterval(alertFunc, 3000);
});
function alertFunc() {
$.ajax({
type: "POST",
url: "<?php echo Yii::app()->createUrl('alarma/ValidarTimeOutSMS'); ?>",
data: {val1:1,val2:2},
success: function(msg){
alert("Sucess")
},
error: function(xhr){
alert("failure"+xhr.readyState+this.url)
}
});
}
</script>
it never show me something… HELLO
Thanks you for your help, I rally I need that it work…