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

  • SEARCH
  • Home
  • 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 8153645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:05:20+00:00 2026-06-06T16:05:20+00:00

I am implementing a function populatig a select box using data from another select

  • 0

I am implementing a function populatig a select box using data from another select box.

//views/users/ajax.ctp
$.ajax({
        url: url,
        type: "GET",
        dataType: "html",
        data:"arr=" + result,
        success: function(data){
            document.getElementById(child).innerHTML = data;
        }
    });

As you can see from the code above the data passed by the call should be accessible in the getSectors() function under the data variable:

//controllers/users_controller.php
function getSectors() {
    $this->set('data', $this->data);
    $this->render('/users/ajax_data');
}

In the corresponding view I try to see the content of the data passed:

//views/users/ajax_data.ctp
<?php var_dump($data); ?>

The $data is null.

Debugging that in Firebug shows that the call is invoked properly (status 200 ok) and that the XMLHttpRequest contains parameters and values.

Do you have any suggestions what could be possibly wrong?

  • 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-06T16:05:22+00:00Added an answer on June 6, 2026 at 4:05 pm

    In order for Cake to populate the $this->data variable, the data being send needs to follow the format data[Model][field], or at least be part of the data[..] array. If it’s plainly named arr, Cake won’t put it in the $this->data variable.

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

Sidebar

Related Questions

I am implementing a function that reads data from file into a multi-dimensional numpy
I tried implementing the children function in ExtJS using select(~ *), it just didnt
When implementing a hash table using a good hash function (one where the probability
I am working on implementing a function that would execute another function a few
i am implementing a function framework in python to be accessed from C#. As
I want to have a AJAX Function of implementing a chained menu + a
i am implementing a PHP application, i am using AJAX heavily in forms to
I'm implementing a function that receives an argument which it needs to convert to
I am implementing a function to recursively reverse a linked-list, but getting seg-fault. typedef
I need some examples of implementing curry function in ruby(1.8.6 or 1.8.7 not 1.9).

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.