Please note that the forum isn't realy used anymore.

If you have questions, want support or just simply want to talk to us you can find us on slack.

 

Ajax call to profile action function

Hi,

I'm trying to make an ajax call to a profile function. Therefor I created a php handler file, but this doesn't give something back... Is there another approach to mix jquery ui datepicker and data from the database?

Thx for your help

Can you show us your code, maybe there's an error in your call

The ajax-call: $.ajax({ type: "POST", url: "http://www.goforzero-facebook.be/src/Frontend/Modules/Profiles/Actions/IndexHandler.php", data: { getAllReservations: 1 }, success: function (data) { closedDates = data;
} });

Indexhandler.php:

namespace Frontend\Modules\Profiles\Actions; use Frontend\Modules\Profiles\Engine\Reservation as FrontendProfilesReservation;

if(isset($POST['getAllReservations']) && $POST['getAllReservations']) { $dates = array(array(6, 25, 2014), array(6, 24, 2014)); return $dates; }

Okay Thanks, I'll try this out :-)

I always get this: Ajax.php 500 (Internal Server Error)...

class SearchReservationDays extends FrontendBaseAJAXAction { /** * The possible dates * * @var int */ private $items;

/**
 * Execute the action
 */
public function execute()
{
    parent::execute();
    $this->future_reservations = FrontendProfilesReservation::getAllReservationsInFuture();
    $items = array();

    foreach($this->future_reservations as $key => $reservation) {
        if ($reservation['time_slot'] == '8am-5pm') {
            continue;
        }
        $items[] = $reservation['reservation_date'];
    }
    print_r($items);
    die();

    // output
    $this->output(self::OK, $items);
}

}

Someone who can help me?

Comment

The forum is deprecated in favor of our Slack channel, which provides real-time support for your issues.

Join us on Slack here: https://fork-cms.herokuapp.com/