hi guys! a quick question about good coding practice!
is it safe/good to break from php and call a js function in the middle of a class?
my code kind of looks like this:
class users{
function login(){
///other login code
?>
<script type="text/javascript">
$.cookie('cookname', '<?php echo $username ?>');
$.cookie('cookpass', '<?php echo $password ?>');
$.cookie('userid', '<?php echo $userid ?>');
</script>
<php
//rest of login code
}
}//end of class
?>
when i want to create the cookies, it breaks from php and uses the ajax cookie plugin. it works perfectly, but im not sure if its a good or safe thing to be doing?
also the reason why im using the ajax plug-in, is that i have another piece of code that uses the cookie straight away, and it wont "see" the cookie exisits until the page is refreshed, this method it sees it straight away
thanks in advance for any advice =)