Salve,
potreste dirmi se il seguente modo è corretto per inviare dei dati, presi da un form, ad un file php che li processa?

codice HTML:
var neonLogin = neonLogin || {};
;(function ($, window, undefined) {
    "use strict";
    $(document).ready(function () {
        neonLogin.$container = $("#form_login");
        var data = {
            username: $("input#username").val(),
            password: $("input#password").val(),
            id: {
                username: "username",
                password: "password"
            }
        };
        // Login Form & Validation
        neonLogin.$container.validate({
            rules: {
                username: {
                    required: true
                },
                password: {
                    required: true
                },
            },
            highlight: function (element) {
                $(element).closest('.input-group').addClass('validate-has-error');
            },
            unhighlight: function (element) {
                $(element).closest('.input-group').removeClass('validate-has-error');
            },
            submitHandler: function (ev) {
                /*     Login form now processes the login data*/
                $(".login-page").addClass('logging-in');
 // This will hide the login form and init the progress bar
                // Hide Errors
                $(".form-login-error").slideUp('fast');
                // We will wait till the transition ends
                                setTimeout(function () {
                    var random_pct = 25 + Math.round(Math.random() * 30);
                    // The form data are subbmitted, we can forward the progress to 70%
                    neonLogin.setPercentage(40 + random_pct);
                    //encrypt password before sending it through the network                    //data.password = CryptoJS.SHA512(data.password).toString();
                    // Send data to the server 
                   $.ajax({
                        url: 'RYVAjax.php',
                        type: 'POST',
                        data: {
                            action: "checkLogin",
                            username: data.username,
                            password: data.password,
                            id: data.id
                        },
                        error: function () {
                            alert("An error occoured!");
                        },
                        success: function (response) {
                            // Login status [success|invalid]
                            var login_status = response.login_status;
    // Form is fully completed, we update the percentage
                            neonLogin.setPercentage(100);
  // We will give some time for the animation to finish, then execute the following procedures
                                setTimeout(function () {                                
                                 if (login_status == 'success') {
                                    window.location = "index.php";
                                } else {
                                    setTimeout(function () {
                                        $(".login-page").removeClass('logging-in');
                                        neonLogin.resetProgressBar(true);
                                    }, 400);
                                }
                            }, 1000);
                        } 
                   });
                }, 650);
            }
        });
Come noterete i dati li prendo tramite una var data:

codice HTML:
var data = {
                username: $("input#username").val(),
                password: $("input#password").val(),
                id: {
                    username: "username",
                    password: "password"
                }
            };