here
if($('#modelname_type').val() == '1'){
change to
var mtype =$('#modelname_type').val();
if(mtype == '1'){
IN AJAX THE
url:'<?php echo Yii::app()->request->baseUrl;?>/index.php/controllerB/actionB/id/"+str';
Will work like a charm