I’m new to Yii. So I have 3 questions:
First:
The following ajax call works well in FF and Chrome but not in IE9. Any idea why?
function mudouservico(){
$.ajax({
type: "POST",
url: "<? echo Yii::app()->createUrl('faturas/DS'); ?>",
data: {serv:codservico.value},
success: function(data){
var jsonOb = eval('(' + data + ')');
servico.value=jsonOb.designacao;
preco.value=parseFloat(jsonOb.preco).toFixed(2).toString();
recalcula();
},
error: function(xhr){
alert("Erro na chamada ao servidor ("+xhr.readyState+")"+this.url);
}
});
}
Second:
What’s the difference between writing javascript code inside a view file using the traditional way…
<script type="text/javascript">
....
</script>
… or registering the script?
Third:
What’s the best yii approach to make calculations between elements on a view? Let’s say changing a Total when Price or quantity changes?
Thank you for your patient and attention to the newbie…