Get the field value through the id and send with ajax
var field = $("#field").val();
$.ajax({
type: "POST",
url: "db.php",
data: {variable_name:field},
async:false,
dataType:"json",
success: function(response) {
alert(response);
}
});
At db.php file get the variable name
$variable_name = $_GET['variable_name'];
mysql_query("SELECT password FROM table_name WHERE password='".md5($variable_name)."'");