how to retrieve data from database through ajax against specific id in yii2 framwork

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


how to retrieve data from database through ajax against specific id in yii2 framwork



_form.php


<?= $form->field($vehicle, 'vehicleRegistrationNumber')->textInput(['maxlength' => true, 'id'=> 'regNum']) ?>



Ajax code


$.ajax({

type:'POST',

cache:false,

data:{regNum:regNum},

url: "<?php echo Url::toRoute('appointments/regAjax.php')?>",

succes: function(response){

console.log('success');

}
});



AppointmentsController



public function actionRegAjax()
{


if(Yii::$app->request->isAjax){
$data= Yii::$app->request->post();
}
}



regAjax.php


<?php
$regNum = $_POST['regNum'];
echo json_encode($regNum);



?>









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

3OfyyAqKd9INr dmr,zEv,vKkuLFwruVT,T iZhqa,5R2qiFlwFghcaZvemmbWaz6IdPe bFW0QXjBb r8TpJohcUXPxTTDG0AGGh
Q7,f7rdmd,gY6,DZtf,C,1lHhDDE SRfzyGWCRBV18os48MLDP7hPuezhGvx,mINpx,NbNIGFVNINzTRQafxLrEWTO39egxyVncYD

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham