Problem With Ajax Call

I have the following code…

$mun_url = Yii::$app->urlManager->createUrl('/localizacion/default/ajax-municipios');

then I execute this ajax function


        type: "GET",

        url: "{$mun_url}",

        data: { estado: 21 },

        success: function(datos){

            alert( "Se guardaron los datos: " + datos);


        error: function(){




:::: controller

namespace app\modules\localizacion\controllers;

use yii\web\Controller;

use yii\helpers\ArrayHelper;

use app\models\LocalizacionMunicipio;

class DefaultController extends Controller


    public function actionAjaxMunicipios($estado)


        echo "<p>hola</p>";




and the browser show me a 500 Internal Error (If I type the url in the browser every works as expected, plz help me

Check runtime/app.log for details of the error.


needs to be encoded before passed in Javascript so try



maybe you should check permission of this file : runtime/debug/