這個函數,ajax ......每件事情都很好。
當我想重新加載$用戶時,它返回相同的$用戶
加載ajax重新加載$用戶新數據後有什麼辦法嗎?如何在加載頁面後重新填充一個變量
控制器
function list_of_users_by_skills($project_ids){
$project_id = json_decode($project_ids);
/* Generate Users by Skills
* By Isaac
*/
$this->loadModel('Training');
//Get list of users by skills
$users_return = $this->Training->find('all', array('conditions' => array('Training.Project_id' => $project_id)));
//some code here to return the $users :)
asort($users);
$this->set('users', $users);
}
查看
var page = 'http://localhost/index.php/shifts/list_of_users_by_skills/[176,196]/';
console.log(page);
$.ajax({
url: page,
success: function(data) {
<?php echo "var user_array = [" . json_encode($users) . "];\n"; ?>
console.log(user_array);
console.log(<?php echo json_encode($users); ?>);
}
});
Yeyyyy !!!!!!謝謝一些。我之前打印了一些HTML標籤,以便爲其他事情進行回顧。它像魅力一樣工作。 ;) – Fury 2013-02-13 16:25:33
@Vahid Rajaei好聽:-) – jeroen 2013-02-13 16:26:25