If I missed a fundamental part tell me. But after googling here I still dont understand why the Ajax code does not work properly.
My java script code
 $(document).ready(function(){ 
       $("#tform").submit(function() {
       var varUserName=$("#UserName").val();
       var varUserEmail=$("#UserEmail").val();
       var varUserPassword=$("#UserPassword").val();
       alert("email: " + varUserEmail + " name: " + varUserName + " pass: " + varUserPassword);
       $.ajax({
        type       : "POST",
        url:"http://mydomain/tesfolder/Insert.php",
        crossDomain: true,
        data       : {UserName : varUserName, UserPassword : varUserPassword,UserEmail:varUserEmail},
        dataType   : 'json',
        success    : function(response) {
            //console.error(JSON.stringify(response));
            alert('Works!');
        },
       error: function(xhr, status, error) {
        //alert("Didnt work");
           //console.error(JSON.stringify(response));
       }
    
    }); 
    
  });
      }); <form id="tform">
                <input class="app-input" type="text" name="UserName" placeholder=" Votre Pseudo" id="UserName">
                <input class="app-input" type="email" name="UserEmail" placeholder="Votre Email" id="UserEmail">
                <input class="app-input" type="password" name="UserPassword" placeholder=" Votre Mot de passe" id="UserPassword">
             <input name="MSubmit" type="submit" value="Submit" id="Msubmit">            
            </form>The PHP codes works properly when I run at localhost.
I also add the following line at the beginning of the php code
<?php 
header("Access-Control-Allow-Origin: *");
...
?>The alert in the java script showed that the form send the data.
I will appreciate your help.
Adjeiinfo
 
    