I would like to set php session with ajax. there is my function to set session in session.php.
public static function set($key, $value) {
$_SESSION[$key] = $value;
}
and I have confirm javascript alert and if I click on yes, i want to set session. How can I set session simply?
EDIT 16.4.2012 15:31 GMT:+1
David: thanks for an answer, it looks clearly. I tried it, but doesn´t do anything at my pc. So I have: a.php
<script src="http://code.jquery.com/jquery-latest.js"></script>
<p>I would like to say: </p>
<script>
$("p").append("<strong>Hello</strong>"); //check jquery is working
$.get('a.php', function(data) {
// do something on success?
});
</script>
b.php (in same folder)
<script type="text/javascript">
alert('aaa');
</script>
<?php
echo "print by b.php";
?>
and I run a.php in browser