I wrote the ajax in the JavaScript function. That code is
function getValidate(checkID)
{
    alert(checkID);
    $.ajax({                  
        type: 'post',
        url: 'checkval.php',
        datatype: 'json',
        data: {checkID : checkID},
        success: function (response) {
          if (response === "OK"){
            alert("Validation Successed.");
        }else if(response === "NG"){
            alert("Check Already Exists.");
        }
    },
        error : function(err, req) {
        alert("Error Occurred");
    }
  });
 }
this code is outputs only "Error Occurred".
the connected php script is
<?php
        echo("welcome");
    $check          = $_POST['checkID'];
    $host       = 'localhost';
        $database   = 'database';
        $username   = 'root';
        $password   = 'root';
    $dbc = mysqli_connect($host,$username,$password,$database);
        $checkno = $check;
        $sql = "select claimno from check_details where checkno = $checkno";
        $result = mysqli_query($dbc,$sql);
        $rows = mysqli_num_rows($result);
        if($rows != 0)
        {
                        echo "NG";
        }
                else
                {
                        echo "OK";
                }   
?>
at a time of calling the JavaScript function php file not executed......
please give me the idea to success it...........
 
     
     
     
     
    