2016-06-28 14 views
-1

ページロード時に次のボタンをクリックしないとDBからアイテムをロードするカルーセルが必要です。 助けてください、私はあなたがPHP、SQL、jQueryの(AJAX)次のボタンをクリックしたときにDBからアイテムをロードカルーセル

PHP使用する必要があると思う事前

+0

キーワードには、ここでの検索は 'ajax'です。概念に慣れてから、jQuery 'ajax()'や 'post()'関数を使いましょう。 – user3154108

+0

ああああああああああ試してみるよありがとう。 – Nupur

答えて

0

で ありがとう:

//This will output using JSON 
header('Content-type: application/json'); 
$getDBData = mysql_query("SELECT * FROM table"); 
while($rows = mysql_fetch_array($getDBData)){ 

$id = $rows['id'] //ID from the DB; 
$name = $rows['name'] //Name from the DB too; 

$JSONfeedback = array(
    "id" => "$id", 
    "name" => "$name" 
); 

    echo json_encode($JSONfeedback); 

} 

JS:

$.post('thatPHP.php',function(feedback){ 
    console.log('This is my id: ' + feedback.id); 
    console.log('This is my name: ' + feedback.name); 
}); 
+0

ありがとう、私はこれを試してみます:) – Nupur

関連する問題