i had develop magento 2 extension and i have use ajax call to my controller for getting some data. but coding standard provide me some error
my controller code is ......
public function execute()
{
echo $mediaUrl.'cs/test/'.$file.$extension;
}
i had use this code for js
function getFileUrl() {
jQuery.ajax({
method: "POST",
url: "<?php echo $block->getUrl('modulename/index/index'); ?>",
data:{itemId:jQuery('input[name=item]').val(),data:jQuery('#file').html() }
}).done(function(data) {
jQuery('#file').val(data);
});
}
if have any solution pleas provide it.