View Single Post
Old 03-14-2018, 02:49 AM
Soptareanu Alex Soptareanu Alex is offline

Join Date: Sep 2016
Posts: 24

Default Dealing with ajax Request

I need to show a message on page after an ajax request is done. In my controller I use \XLite\Core\TopMessage::addInfo() interface, but the message I can see only if I reload the page after recive the response from server.
This is my controller :

$return = array(
'deliveryDate' => 'Some data',
'orderId' => 'Some data

$return = json_encode($return);
header('Content-Type: application/json; charset=UTF-8');
header('Content-Lenght: '.strlen($return));
header('ETag:' . md5($return));

'Your delivery date is ' . date('d-M-Y', $deliveryDate)

echo $return;


And this is the function responsable to do the ajax request
function changeDate(_deliveryDate, _orderId){
var shippingMethods = jQuery('.embed_calendar');
assignShadeOverlay(shippingMethods, true);
target : 'calendar',
action : 'changedate',
deliveryDate: _deliveryDate,
orderId : _orderId
var shippingMethods = jQuery('.embed_calendar');
unassignShadeOverlay(shippingMethods, true);

Is there a posibility to view the message after the request is done in this mode ?
Reply With Quote