title: Why 'var ehy = "php echo $dunno"'?
body: <p>I want to get some keyword by a textarea by using this js code. Obviously, I need PHP code too, but I have a problem with the string - <code>var ehy = "php echo $dunno"</code>. Why this? Can anyone help me?    </p>
  
  <pre><code>&lt;?php
  if (isset($_POST['line'])) {
  $line = $_POST['line'];
  $dunno = (explode(" ", $line));
  }
  ?&gt;
  &lt;script&gt;
  function countLines(){
      var stringLength = document.getElementById("myText").value.length;
      var count = Math.ceil( stringLength / document.getElementById("myText").cols ); 
      // just devide the absolute string length by the amount of horizontal place and ceil it
      return count;
      }
  function what(){
      var n = countLines()
      var tarea = document.getElementById('myText')
      var lines = tarea.value.split("\n")
      //for(var x = 0; x &lt; lines.length; x++) {
          $.ajax({
              type: "POST",
              url: "",
              data: "line="+lines,
              success: function(){
                  var ehy = "&lt;?php echo $dunno; ?&gt;"
                  $('#what').text(ehy)
                  },
              });
          //} 
  }
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;h1&gt;SearchFunction()&lt;/h1&gt;
      &lt;textarea rows="10" cols="70" id="myText"&gt;&lt;?php echo "what the hell?";?&gt;&lt;/textarea&gt;
      &lt;input type="button" onclick="what()"/&gt;
      &lt;p id="try"&gt;&lt;/p&gt;
      &lt;p id="what"&gt;&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>