I have a page which has already done some ajax calls to php and has set some session variables. within my main page i need to now check these session varibles.. if i was to use javascript the code could be something like <input id="question" type="text" name="question" maxlength="100" value="<?php echo "" ?>" style="width:590px" onkeydown="output()" /> <script language="javascript" type="text/javascript"> function output() { <?php if ( $_SESSION ["proselected"] == "yes" ) { ?> document.speakerForm.question.readOnly=false; <?php } else { ?> document.speakerForm.question.readOnly=true; <?php } ?> //alert("hello"); } </script> Code (markup): The problem with this obviously is that the session variable is always going to be set to no because when the main page loaded the proselected session variable had not been set. So, I need a way using ajax to check the state of the proselected session variable and if it is set to yes then the textfields readonly state can be set to false.. thanks..