Veritabanımdan, özellikle de iki sütundan veri elde eden bir Ajax İsteğim var, company_id ve people_id, Json sonucundan gelen sonucu test etmem gerekiyor, belirli bir people_id'in var olup olmadığını kontrol etmem gerekiyor sonuç, İşte Döndürülen json sonucu nasıl test edilir?
Ben başarı işlevinde bu aşağıdaki kodu yapabilirdi ama burada daif (data == 0) {
Ext.MessageBox.alert('Status', 'Person is not attached to anything bud!.');
}
else {
Ext.MessageBox.alert('Status', 'Person already attached to another company.');
}
işe yoktu düşünce benim php benim Ajax İsteği
Ext.Ajax.request({
url: 'system/index.php',
method: 'POST',
params: {
class: 'CompanyPeople',
method: 'secget',
data: Ext.encode({
people_id: Ext.getCmp('peopleGrid').selectedRecord.data.people_id
})
},
success: function (response) {
},
failure: function() {
}
});
olduğu
class CompanyPeople extends Connect {
function __construct() {
parent::__construct();
}
public function secget($vars) {
$sql = "SELECT * FROM CompanyPeople where people_id={$vars->data->people_id}";
$data = array();
$total = 0;
if ($result = $vars->db->query($sql)) {
while ($row = $result->fetch_assoc()) {
$data[] = array("people_id" => intval($row["people_id"]));
$total++;
}
$result->free();
}
echo json_encode(array("success" => true, "total" => $total, "topics" => $data));
}
}
benim kod biçimlendirme sabitleme için deyimi ise –
sayesinde koymak ne kadar emin değilim, ben korkunç –