How to pass image data using Ajax to server side in backend magento 2?

By default Image data are not post using ajax. only plain data will be passed as Ajax post. if we need to pass image data using ajax we need to call ajax as below way,
Call jquery using requirejs way in backend template file,
Let’s create a simple example of the form,

We need to Use You FormData() object of Javascript to store our image data and using above way we can just send image data to server side using ajax.

How to remove all special characters from a string with magento 2 as a best practice?

Magento Contains Match.php file they contain CONSTANT like SPECIAL_CHARACTERS and with that constant all the special character are available.
File path is Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match.php

When we need to remove or replace special character with some other character you can use Magento default constant.

Match.php file with a constant declaration like as below,
const SPECIAL_CHARACTERS = ‘-+~/\\<>\'”:*$#@()!,.?`=%&^’;
When we need to modify a string with special character to some custom value or blank you can do as below way,

The result will be, Replace all special character with one space.
“Test1 23 45 789 1”

How to get customer data by customer id in magento 2?

You can get customer information by just passing customer id using below code snippet, Create Block file,

Call getCustomer($id) function in template file,

Get all customer data by below way,

echo “<pre>”;print_r($customer->__toArray());