i am sending ajax request to server to get the database. But if i enter incorrect data (which is to be sent over server) nothing is happening, error function is not working, all i am doing is to verify credentials from the server
here is my code
$.ajax
    ({
        url: "URL",
        type: "GET",
        datatype: "jsonp",
        data: {type: 'login', id: C_id},
        ContentType: "application/json",
        success: function(res) 
        {
            var simpleJson = JSON.parse(res);
            myDB.transaction(function (txe1) 
            {
                for (var i = 0; i < simpleJson.User.length; i++) 
                {
                    var Cli_id= simpleJson.User[i].id;
                    myDB.transaction(function (txe) 
                    {
                        txe.executeSql('CREATE TABLE Client_data(Mobile integer , C_id integer, U_id integer , name text , ip integer )');
                    }); 
                    myDB.transaction(function (txe1) 
                    {
                        var data_ins = 'INSERT INTO Client_data (Mobile,C_id,U_id) VALUES (?,?,?)';
                        txe1.executeSql(data_ins, [p,C_id,U_id]
                        ,function(tx, result)
                        {
                            navigator.notification.alert('Inserted' ,  onSignup, 'Info', 'ok'); 
                        },
                        function(error)
                        {
                            navigator.notification.alert('Already Registered'); 
                        });
                    });
                }
            });
        },
    });
});
my PHP code
<?php
header('Access-Control-Allow-Origin:*');
$conn = mysql_connect("***", "***", "****");
if (!$conn) 
{
    echo "Unable to connect to DB: " . mysql_error();
    exit;
}
if (!mysql_select_db("ekspeser_pro")) 
{
    echo "Unable to select mydbname: " . mysql_error();
    exit;
}
if(isset($_GET['type']))
{
    if($_GET['type'] == "login")
    {
        $id=$_GET['id'];    
        $sql = "SELECT  * from client_master WHERE id='$id'";
        $result = mysql_query($sql);                            
        $num_rows = mysql_num_rows($result);
        if($num_rows!=0)
        {
            while($myrow = mysql_fetch_assoc($result)) 
            {
                $recipes[]=$myrow;
            }
            $output = json_encode(array('User' => $recipes));
            echo $output;
        }
        else
        {
             print "invalid key";
        }
    }
    else
    {
        print "invalid login";
    }   
}
    else
    {
        echo "invalid";
    }
mysql_close();
?>
 
     
    