Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8315255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:05:30+00:00 2026-06-08T21:05:30+00:00

I would like to retrieve selected value from dropdown and pass it using Yii’s

  • 0

I would like to retrieve selected value from dropdown and pass it using Yii’s ajaxLink function via POST method.

I can retrieve the values in the beforeSend part, for example,

array( // ajaxOptions
    'type' => 'POST',
    'beforeSend' => "function() {                                  
         start_time = jQuery('#start_time').find(':selected').val();
         end_time = jQuery('#end_time').find(':selected').val();

         this.data += '&start_time='+start_time;
         this.data += '&end_time='+end_time;
    }",
    .......

I can format the string, pass it and parse it in the controller but I’m using protection from CSRF and if I pass parameters as a single string I get “CSRF token could not be verified” error.

Looking forward to your replies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:05:31+00:00Added an answer on June 8, 2026 at 9:05 pm

    Put everything in a form and submit it (via an AJAX request) – then the form will POST it as usual, and you don’t have to munge any values. Alternatively, you could attach AJAX directly to the dropdown via htmlOptions, e.g.:

    <form>
    <?php
        echo CHtml::listBox('field', '', $fieldData,
            array('ajax' => array(
                'type' => 'POST',
                'url' => Controller :: createUrl($controllerAction),
                'dataType'=>'json',
                'success'=>'function(data) { console.log(data) }'
                ),
            )
        );  
    ?>
    

    This way, the detail will get submitted via the form POST; you can do any munging you need in PHP after you’ve got the value submitted.

    If you need a submit type item, I’d use an ajaxSubmitButton() instead of an ajaxLink(), and then you’re getting all the form data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like get meaning of selected word using wikionary API. Content retrieve data
I would like to retrieve the AppSetting key from the assembly config file called:
I'm using the python suds module and would like to retrieve the response headers
I would like to retrieve the contents of a file, filter and modify them
I would like to retrieve an ordered query result, but I need to have
I would like to retrieve the categories of my website in order to build
I am saving images to the photo library and would like to retrieve them
I have a set of URLs for which I would like to retrieve the
I am adding data to my database, but would like to retrieve the UnitID
I have an SQL Server 2000 db, and I would like to retrieve summary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.