[英]Joomla - Create session variable from checkbox with ajax
當選中復選框時,我正在嘗試使用ajax創建會話變量joomla樣式。 這是我在select_thumb.ajax.php文件中的代碼:
$_SESSION['ss'] = $value;
$response = $_SESSION['ss'];
echo $response;
}
exit;
// Get db connection
$db = JFactory::getDbo();
//create new query object
$query = $db->getQuery(true);
//Prepare insert query
$query
->insert($db->valueChbx('download_variable'))
// Set the query using populated query object and execute it.
$db->setQuery($query);
$db->execute();
?>
這是復選框的我的HTML:
<input type="checkbox" id="thumbselect" name="valueChbx" class="checkbox" value="/import/images/'+data[i]['filename']+'">';
我還沒有通過javascript編碼ajax,因為我想知道是否應該使用onFocus? 可能選中了多個復選框。 感謝您的任何幫助。
不要在Joomla應用程序中使用PHP的默認會話變量,而應使用其本機工廠。
設置會話變量
$session = JFactory::getSession();
$session->set('name', "value");
獲取會話變量
$session = JFactory::getSession();
echo $session->get('name');
更多 。
希望能幫助到你..
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.