Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method POST #7

Closed
crissty opened this issue May 25, 2017 · 4 comments
Closed

Method POST #7

crissty opened this issue May 25, 2017 · 4 comments

Comments

@crissty
Copy link

crissty commented May 25, 2017

HELLO,
HOW IS IT MADE THAT A MENU LINK IS SENT BY POST METHOD, INSTEAD OF GET METHOD?

THANKS!!

@crissty
Copy link
Author

crissty commented May 29, 2017

I have the same problem. I want one of menu links to be by post method. Have you found the solution?

Thanks!!

@kartik-v
Copy link
Owner

kartik-v commented May 29, 2017

Please do not duplicate post over your post appearing as a new poster.

You need to write your own javascript code for this on click of each menu item to trigger your POST request (via AJAX or something similar by using a hidden form submit). By default <a href links in native HTML trigger a GET call. Yii includes a feature as part of its Javascript library (when you include YiiAsset) that converts your links to POST if you set the property data-method = 'post'.

@crissty
Copy link
Author

crissty commented May 29, 2017

Thanks, but I have solved it adding a link to the label field, and commenting on the url field:

[ 'label' => Html::a('LOG OUT ,['/user/logout'],['data-method' => 'post']), /* 'url' => '', */ ]

@nimaan1970
Copy link

nimaan1970 commented Jul 26, 2023

image

used in SideNav menu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants