Jquery + Ajax, Params has data but response says no data
问题 I have the following script: $("#spid").blur(function() { $.ajax({ url: 'getsponsor.php', type: "POST", dataType:'json', data: ({ spid: $("#spid").val() }) , contentType: 'application/json; charset=utf-8', success: function (result) { $("#sponname").text(result); }, error: function () { $("#sponname").text("Cannot fetch the sponsor name."); } }); }); Note: #sponname is a label tag. Following is the php code of getsponsor.php: if(!isset($_POST['spid']) || empty($_POST['spid'])) echo json