[jQuery] json not working

[jQuery] json not working

Hi alll
$(document).ready(function(){
$("#postcode").keyup(function(){
var txtvalue = $("#postcode").val();
alert(txtvalue)
$.ajax({
  method:"POST",
  url: "data.php",
  data:"txtvalue="+txtvalue,
  dataType: "json",
 success: function(data) {
    // Go do this, go do that…
    alert(data);
}});
});
});
This is my code ,
data type:json not working ,
Please tell me Why?
Thanks