Hello everyone,
How can I use data-request-redirect to redirect to a page that expects a URL parameter, where that parameter is generated by the component’s AJAX handler?
For example, I have a handler called onCreateItem that creates an element from the Item model.
The component’s response is:
return [
'success' => true,
'message' => 'Item created successfully',
'item_id' => $item->id,
'item_uniq_name' => $item->item_uniq_name
];
I’d like to use data-request-redirect so that after the Ajax operation completes, the user is redirected to /site/item-details/item_id.
I’d prefer not to do the redirect from the component itself, since the handler may be used in different parts of the site, and redirection isn’t always required. So this responsibility should fall on the front end.
To start with, I already have the item-details page configured with the URL /site/item-details/:item_id, so the page is ready to receive that parameter.
Best regards, and thanks!