title: POST method in AJAX
body: <p>i am passing variables using post method but not able to pass complete value of variables .</p>
  
  <p>Here is script:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
  
      var problem_code = $("#problem_code").val();
      var code = $("#code").val();
      var lang = $("#lang").val();
      $.ajax({
          type: "POST",
          url: "ajax.php",
          cache:false,
          data : {problem_code:problem_code,code:code,lang:lang},
          success: function(html)
          {
              //alert("ajax response returned.. ");
              //console.log(html);
              $(".show-result").empty();
              $(".show-result").append('&lt;br&gt;' + html);
          }
      })
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>And here is the rest part </p>
  
  <pre><code>&lt;?php 
  $code=stripcslashes($_POST['code']);
  $lang=stripcslashes($_POST['lang']);
  ?&gt;
  </code></pre>
  
  <p>Getting $code and $lang value pass by another file "Submit.php"</p>
  
  <p>Now using input hidden fields</p>
  
  <pre><code>    &lt;input type="hidden" id="problem_code" name="problem_code" value=&lt;?php echo $problem_code;?&gt; &gt;
  &lt;input type="hidden" id="code" name="code" value=&lt;?php echo ($code);?&gt; &gt;
  &lt;input type="hidden" id="lang" name="lang" value=&lt;?php echo $lang;?&gt; &gt;
  </code></pre>
  
  <p>but while passing $code value using hidden fields it is showing unexpected behaviour.</p>
  
  <p>here is view-source example while running above scripts</p>
  
  <pre><code>&lt;input type="hidden" id="problem_code" name="problem_code" value=LUCPAL &gt;
  &lt;input type="hidden" id="code" name="code" value=#include &lt;iostream&gt;
  #include&lt;stdio.h&gt;
  #include&lt;math.h&gt;
  using namespace std;
  int main() {
  int t;
  scanf("%d",&amp;t);
  while(t--)
  {
      long long int A,B,copy,sum=0;
      scanf("%lld %lld",&amp;A,&amp;B);
      copy=B;
      int digit=0;
      while(copy&gt;0)
      {
          digit++;
          copy=copy/10;
      }
      while(digit--)
      {
          sum=10*sum+9;
      }
      long long int sum2=sum/2,diffA,diffB;
      if(sum2&gt;=A &amp;&amp; sum2&lt;=B)
      {
          printf("%lld
  ",(sum2)*(sum2+1));
      }
      else
      {
          diffA=fabs(sum2-A);
          diffB=fabs(sum2-B);
          if(diffA&lt;diffB)
              printf("%lld
     ",A*(sum-A));
          else
          printf("%lld
      ",B*(sum-B));
  
      }
  }
  // your code goes here
  return 0;
  }
  &gt;
  
  &lt;input type="hidden" id="lang" name="lang" value=11 &gt;
  `
      printf("%lld\n",A*(sum-A) become  printf("%lld
  
      ",A*(sum-A));
  </code></pre>
  
  <p>and only '#include' pass in ajax.php from all code.</p>