2
私は、単純な自動補完jQueryのPHPのクラスとjQuery
$(document).ready(function() {
$(".autocomplete").each(function() {
$(this).autocomplete({
source: '/php/LiveSearch2.php?name='+ $(this).attr('name') + '&',
minLength: 1,
appendTo: "#container"
});
});
});
を持っている私が値をプッシュするPHPのクラスを書かれているが、それは動作しません。私はどこかで間違いを犯している。以下はLiveSearch2.phpです
<?php
class swapnil {
private $testname;
public $json;
public function __construct {
$this->testname = array('swapnil','ranadive');
$this->json = json_encode($this->testname);
echo $this->json;
}
}
$Business = new swapnil();
?>
私はクラスなしでPHPコードを使用するとうまくいきます。
<?php
$testname = array('swapnil', 'ranadive');
$json = json_encode($testname);
echo $json
?>
ありがとうございますが、それも動作していません。 –
@SwapnilRanadiveデータを適切にエコーします。自動完了を確認してください。ありがとう、 –
はい、パスが正しくありませんでした。ご協力いただきありがとうございます。 –