Send data via Ajax to set entity fields

I’m working on a custom module that works with Ajax to create or update entities. But I’m wondering how I can send data via Ajax to be set in the entity fields. So looking at the example below..how to I fetch the my_id variable value 10 inside the mymoduleAjaxCheck function?

Focussing on the most important part of my code I have:

a my_module.routing.yml file:

my_module.ajax_check:
  path: '/js/my_module/ajax/{nid}'
  defaults:
    _controller: 'Drupalmy_moduleControllerMyModuleController::mymoduleAjaxCheck'
  requirements:
    _csrf_token: 'TRUE'

I have a script.js file:

var my_id = 10;
$.ajax({
  type: 'get',
  url: callbackUrl,
  dataType: 'json',
  data: 'my_id=' + count
});

And I have a src/controller/MyModuleController.php file:

/**
* Controller routines for user routes.
*/
class MyModuleController extends ControllerBase {
  /**
  * Saving entity
  */
  public function mymoduleAjaxCheck() {
     // how do I get the ajax data variable my_id here?
  }
}