I am having problems with the following jquery code
$this->registerJs( 'jQuery(document).ready(function($){ $(".member").on("change",function(){ var id = $(this).attr("id"); // alert(id); var n = $(this).val(); // alert(n); $.post("'.\Yii::$app->getUrlManager()->createUrl(['death/stl_set_relation','id'=>'+id']) .'&name="+id) }); });' );
I want the ajax link to be like this http://192.168.1.4/~user/church/backend/web/death/stl_set_relation?id=20&name=1
but with my code, I cannot pass the id value correctly. that my code creates the following url
http://192.168.1.4/~user/church/backend/web/death/stl_set_relation?id=%2Bid&name=20
I tried this too
$.post("'.\Yii::$app->getUrlManager()->createUrl(['death/stl_set_relation','id'=>'"+id"']) .'&name="+id)
but it did not give me the desired result
How can I pass the id value correctly?
source share