mercredi 28 janvier 2015

yii2 POST parameters mapping


Vote count:

0




i have some js script that send simular data:



$.ajax({
type: "POST",
url: '/manage/add-shops/',
data: {'id':id, 'shops': shops}


'shops' is array with ~1000 elements, so i should send it via POST. I have a yii2 Controller with method:



class ManageController extends Controller {
public function actionAddShops($id, $shops=array()) {
....
}


Routing is Ok, but i get this error:



"Missing required parameters: id"


It's look like that POST params doesn't mapped to method params. Thanks.



asked 1 min ago


1 Answer



Vote count:

0





class ManageController extends Controller {
public function actionAddShops() {
echo $_POST;
}


Here you go.



answered 10 secs ago

Vick

262





yii2 POST parameters mapping

Aucun commentaire:

Enregistrer un commentaire