I have tried url.build
to build request url for ajax call in magento 2, it does not work ?
JS File code: ( view/adminhtml/web/js/files.js)
/*global window,requirejs*/
requirejs(['jquery', 'Magento_Ui/js/modal/confirm', 'mage/url'], function ($, confirmation, urlBuilder) {
'use strict';
$('body #custom_email_button').on('click', function () {
var requestUrl = urlBuilder.build('productpricequote/email/send');
console.log(requestUrl);
});
});
Output:
'productpricequote/email/send'
Any help much appreciated!
Thanks