2016-06-28 69 views

回答

0

我认为你需要使用PHP,SQL,jQuery的(AJAX)

PHP:

//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