&lt;script type="text/javascript"&gt;     var a=10; &lt;/script&gt;  &lt;?php echo $value; ?&gt;   I want to get the value of variable "a" to PHP variable "$value" without ajax request.
85912
I am using PHP and JavaScript. My JavaScript code contains a function, get_data():  function get_Data(){     var name;     var job;     .....      return buffer; }   Now I have PHP code with the following.  &lt;?php     $i=0;     $buffer_data;      /* Here I need to get the value from JavaScript get_data() of buffer;        and assign to variable $buffer_data. */ ?&gt;   How do I assign the JavaScript function data into the PHP variable?
42221
A friend asked me last week how to enumerate or list all variables within a program/function/etc. for the purposes of debugging (essentially getting a snapshot of everything so you can see what variables are set to, or if they are set at all). I looked around a bit and found a relatively good way for Python:   #!/usr/bin/python                                                                                                                                                                                                                            foo1 = "Hello world" foo2 = "bar" foo3 = {"1":"a",         "2":"b"} foo4 = "1+1"  for name in dir():     myvalue = eval(name)     print name, "is", type(name), "and is equal to ", myvalue   which will output something like:   __builtins__ is &lt;type 'str'&gt; and is equal to  &lt;module '__builtin__' (built-in)&gt; __doc__ is &lt;type 'str'&gt; and is equal to  None __file__ is &lt;type 'str'&gt; and is equal to  ./foo.py __name__ is &lt;type 'str'&gt; and is equal to  __main__ foo1 is &lt;type 'str'&gt; and is equal to  Hello world foo2 is &lt;type 'str'&gt; and is equal to  bar foo3 is &lt;type 'str'&gt; and is equal to  {'1': 'a', '2': 'b'} foo4 is &lt;type 'str'&gt; and is equal to  1+1   I have so far found a partial way in PHP (courtesy of ) but it only lists all variables and their types, not the contents:   &lt;?php // create a few variables $bar = 'foo'; $foo ='bar'; // create a new array object $arrayObj = new ArrayObject(get_defined_vars()); // loop over the array object and echo variables and values for($iterator = $arrayObj-&gt;getIterator(); $iterator-&gt;valid(); $iterator-&gt;next())         {         echo $iterator-&gt;key() . ' =&gt; ' . $iterator-&gt;current() . '&lt;br /&gt;';         } ?&gt;   So I put it to you: how do you list all variables and their contents in your favorite language?    Edit by : I propose this question follows the spirit of a little "". If you do not agree, just edit and remove the tag and the link.
43780
I want to pass the java-script value to controller.I am using repeat on VF page.  VF page      &lt;apex:repeat value="{!listAdj}" var="Adj" id="hrs"&gt;       &lt;td&gt;&lt;div class="requiredInput"&gt;&lt;div class="requiredBlock"&gt;&lt;/div&gt;     &lt;apex:inputField id="decimal" value="{!Adj.Hours_Decimal__c}" onchange="setHidden5(this);" &gt;       &lt;/apex:inputField&gt;     &lt;/div&gt;&lt;/td&gt;             &lt;apex:inputField id="hours" value="{!Adj.Hours__c}" /&gt; &lt;apex:inputField id="decimal" value="{!Adj.Hours_Decimal__c}" onchange="setHidden5(this);"/&gt;              &lt;/apex:repeat&gt;   Javascript code  function setHidden5(element){     //split the id of the inputField by ':' and then use the 5th index in the array to exact position of the inputField in the apex:repeat.   var idArray = element.id.split(':');     var hiddenRep1 =document.getElementById("thePage:form:hrs:hrs:"+idArray[4]+":decimal");          var hiddenRep2 = document.getElementById("thePage:form:hrs:hrs:"+idArray[4]+":hours");       if(element.value.length &gt;=1){        document.getElementById("thePage:form:hrs:hrs:"+idArray[4]+":hours").disabled = true; **hiddenRep2.value=hidden1.value;**                }                             }     }   I want to pass the hiddenRep2.value to controller.How to pass that. Hidden2.value is same as hidden1.value + some addition subtraction.i dont know how to pass that value. Can someone me sort out this.  Thanks
4564
I can write  VAR=$VAR1 VAR=${VAR1} VAR="$VAR1" VAR="${VAR1}"   the end result to me all seems about the same. Why should I write one or the other? are any of these not portable/POSIX?
36608
I can get the element like this $("#txtEmail") but I'm not sure how to get the actual value.
4318
I was wanting to initialize some strings at the top of my script with variables that have no yet been set, such as:  str1='I went to ${PLACE} and saw ${EVENT}' str2='If you do ${ACTION} you will ${RESULT}'   and then later on PLACE, EVENT, ACTION, and RESULT will be set. I want to then be able to print my strings out with the variables expanded. Is my only option eval? This seems to work:  eval "echo ${str1}"   is this standard? is there a better way to do this? It would be nice to not run eval considering the variables could be anything.
96971
What is the Java equivalent of PHP's $_POST? After searching the web for an hour, I'm still nowhere closer.
26387
I have a text file in the root of my web app  and I'd like to load it into a variable in javascript.. in groovy I would do this:  def fileContents = 'http://localhost/foo.txt'.toURL().text; println fileContents;   How can I get a similar result in javascript?
40166
Is there a way to use constants in JavaScript?  If not, what's the common practice for specifying variables that are used as constants?
88730
If I have a script tag like this:  &lt;script     id = "myscript"     src = "http://www.example.com/script.js"     type = "text/javascript"&gt; &lt;/script&gt;   I would like to get the content of the "script.js" file. I'm thinking about something like document.getElementById("myscript").text but it doesn't work in this case.
55413
The question is pretty straight forward. I can get the exit code of the previous command by using $?. But what exactly is it?  I don't think it is a variable, because you can't have any special characters in the name of variable other than _.  foo?foo=10   will result in the error: foo?foo=10: command not found  So if it is not a variable, what is it? Are there others like it?
122
What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally?
67748
I have a simple html block like:  &lt;span id="replies"&gt;8&lt;/span&gt;   Using jquery I'm trying to add a 1 to the value (8).  var currentValue = $("#replies").text(); var newValue = currentValue + 1; $("replies").text(newValue);   What's happening is it is appearing like:  81  then  811  not 9, which would be the correct answer.  What am I doing wrong?
28663
I found this line in a korn shell script:  var=${var:-/temp}   I am able to figure it out what it is doing   $ var=/data $ var=${var:-/temp} $ echo $var /data $ var= $ echo $var  $ var=${var:-/temp} $ echo $var /temp   Does it have advantage over checking the value and then assigning?
9579
What is the difference between HTML &lt;input type='button' /&gt; and &lt;input type='submit' /&gt;?
45221
&gt; echo "hi" hi &gt; VAR='echo "hi"' &gt; $VAR "hi"   Why is the output of the above commands different?  A similar thing occurs with single quotes:  &gt; VAR="echo 'hi'" &gt; $VAR &gt; 'hi'
4477
Let's say I have some XML like this  &lt;channel&gt;   &lt;item&gt;     &lt;title&gt;This is title 1&lt;/title&gt;   &lt;/item&gt; &lt;/channel&gt;   The code below does what I want in that it outputs the title as a string  $xml = simplexml_load_string($xmlstring); echo $xml-&gt;channel-&gt;item-&gt;title;   Here's my problem.  The code below doesn't treat the title as a string in that context so I end up with a SimpleXML object in the array instead of a string.  $foo = array( $xml-&gt;channel-&gt;item-&gt;title );   I've been working around it like this  $foo = array( sprintf("%s",$xml-&gt;channel-&gt;item-&gt;title) );   but that seems ugly.  What's the best way to force a SimpleXML object to a string, regardless of context?