不能通过ajax php在sql中插入值

i'm trying to understand this error but i dont how to solve it this is my JS code:

$.ajax({
                url: 'C:\\inetpub\\wwwroot\\VisionwareHelp\\Php/CriaUserEempresa.php',
                type: "POST",
                data: ({Pname: Pname, Uname: Uname, email: email, Ename: Ename, Sigla: Sigla}),
                complete:function(data) 
                {
                    resposta = data;
                    console.log(resposta);
                }
            });

this is my php code:

$serverName = $server;
$uid = $uid;
$pwd = $pass;
$connectionInfo = array( "UID" => $uid, "PWD" => $pwd,"Database"=>"Portal");
//$connectionInfo = array("Database"=>"Portal");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$Pname = $_POST["Pname"];
$Uname = $_POST["Uname"];
$email = $_POST["email"];
$Ename = $_POST["Ename"];
$Sigla = $_POST["Sigla"];

if( $conn )
{
    $sqlCliente = "INSERT INTO Portal.dbo.Empresa VALUES ($Ename, $Sigla)";
    if (mysqli_query($conn, $sqlCliente)) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sqlCliente . "<br>" . mysqli_error($conn);
    }

}

when i do console.log of data, give me this: log

what is wrong with my code?

Try to change into $sqlCliente = "INSERT INTO Portal.dbo.Empresa VALUES ('$Ename', '$Sigla')";

I think problem with your sql insert statement.

$sqlCliente = "INSERT INTO Portal.dbo.Empresa(Ename,Sigla) VALUES ($Ename, $Sigla)";

OR

$sqlCliente = "INSERT INTO Portal.dbo.Empresa VALUES ($Ename, $Sigla,..... Add all parameters to here)";

url: 'C:\\inetpub\\wwwroot\\VisionwareHelp\\Php/CriaUserEempresa.php',

This line is incorrect.

PHP files need a server to get executed. By the looks of your path, it looks like you have hosted in IIS. IIS doesn't suppport PHP by default - so assuming you have installed PHP and configured properly, read below.

You don't post to the physical path of the PHP file, rather URL of the PHP.

Therefore, it should look something similar to:

url: localhost/VisionwareHelp/php/CriaUserEempresa.php',

Until you fix the URL to the correct one, none of your posting code will work correctly.

If you have not installed PHP on IIS, then you need to download and install a PHP-enabled server like 'WampServer' and host your PHP in that.

Also, read below articles - it will help to improve your knowledge.

In Ajax, The correct syntax of sending multiple data is: http://api.jquery.com/jQuery.ajax/

So, Replace

data: ({Pname: Pname, Uname: Uname, email: email, Ename: Ename, Sigla: Sigla}),

with

data: {'Pname':Pname, 'Uname':'Uname', 'email':email, 'Ename':Ename, 'Sigla':Sigla },

And this line url: 'C:\\inetpub\\wwwroot\\VisionwareHelp\\Php/CriaUserEempresa.php', is also incorrect.

replace

url: 'C:\\inetpub\\wwwroot\\VisionwareHelp\\Php/CriaUserEempresa.php',

with

url: 'Php/CriaUserEempresa.php',

Hope it will help you..