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; }
Someone?
I think you need to work with the FrontendBaseAjaxAction class in Fork CMS. Read the documentation about Ajax calls
For example, the Fork CMS catalog module has a few Ajax calls.
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?