AJAX未发送数据

I am using the following code to get data from an input field and send it to PHP by POST but its not working

<script type="text/javascript">
  $(document).ready(function () {
      $("#id_1").change(function () {
          var rat1 = $(this).val();
          $.ajax({
              url: "upload.php",
              type: "post",
              data: rat1,
              success: function (response) {
                  // you will get response from your php page (what you echo or print)

              },
              error: function(jqXHR, textStatus, errorThrown) {
                  console.log(textStatus, errorThrown);
              }


          });
      });
  });
</script>

this is the input form

<input type="number" name="your_awesome_parameter" id="id_1" class="rating" data-clearable="remove"
                           data-icon-lib="fa" data-active-icon="fa-heart" data-inactive-icon="fa-heart-o"
                           data-clearable-icon="fa-trash-o"/>

</div>

You need to provide a name for the parameter. It should be:

data: { param_name: rat1 }

Then in upload.php you access it with $_POST['param_name']

Try in this way men

function realizaProceso(valorCaja1, valorCaja2){
    var parametros = {
            "valorCaja1" : valorCaja1,
            "valorCaja2" : valorCaja2
    };
    $.ajax({
            data:  parametros,
            url:   'ejemplo_ajax_proceso.php',
            type:  'post',
            beforeSend: function () {
                    $("#resultado").html("Procesando, espere por favor...");
            },
            success:  function (response) {
                    $("#resultado").html(response);
            }
    });

}

Just in case, did you imported Jquery into your project? I tested your code and I with the minor change that Barmar specified and it is working for me.

Try to use this code in your php file and see if you get any response in the developer tools console.

$data = $_POST["param_name"];
echo json_encode([$data]);

change on input type number is not working in older versions of browsers, I think not sure. But try this below solution as you are using input type number.

$("#id_1").on("mouseup keyup",function () {
    //your logic here
});

and passing data as already mentioned by others:

data: { param_name: rat1 }