I am submitting the form by ajax. It's working properly but I have one issue with the success message.
After ajax success, I have to display success message like default Magento2. How can I achieve this?
$.ajax({
url: "<?php echo $block->getUrl('frontname/order/save'); ?>",
type: "POST",
dataType: "text",
data: "cancel= " + orderJSON,
showLoader: true,
success: function () {
$("#" + id).remove();
window.location.reload();
}
});