I have the following code…
$mun_url = Yii::$app->urlManager->createUrl('/localizacion/default/ajax-municipios');
…
then I execute this ajax function
$.ajax({
type: "GET",
url: "{$mun_url}",
data: { estado: 21 },
success: function(datos){
alert( "Se guardaron los datos: " + datos);
},
error: function(){
alert("error");
}
});
:::: 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>";
exit();
}
}
and the browser show me a 500 Internal Error (If I type the url in the browser every works as expected, plz help me