1

I want to post 3 variables. Request,Arival,Departure. It must be somewhere in the script. I tried different ways but can't get it working

  Request = '{REQUEST}',
  Arrival = '{ARRIVAL}',
  Departure = '{DEPARTURE}'

My script is:

<script>

   jQuery().ready(function(){
     setInterval("getResult()",1000); 
 });

   function getResult(){   
     jQuery.post("search.php", function( data ) {
     jQuery("#show").html(data);
 });
}
</script>

<button onclick="getResult()" >Get result</button>
<div id="show"></div>
1
  • How have you tried posting the variables? I don't see the different ways you tried in your example code. Commented Aug 11, 2015 at 18:22

3 Answers 3

1
$.post( "search.php", {string: string, name: name}, function( data ) {
  $( "#show" ).html( data );
});

best reference: http://api.jquery.com/jquery.post/

Sign up to request clarification or add additional context in comments.

Comments

0

You should read some documentation and try something out before you ask something in StakOverflow.

http://api.jquery.com/jquery.post/

$.post( "test.php", { name: "John", time: "2pm" } );

Comments

0

I got the script working, but when i renew the variables notting happens.The values of variables don't renew.

  <script>
  function getResult()
  {   
  jQuery.post( "search.php", { request: '{REQUEST}', arrival: '{ARRIVAL}', departure: '{DEPARTURE}' })
  .done(function( data ) {
  jQuery("#show").html(data);

      });
  }
  </script>

  <button onclick="getResult()" >Get result</button>
  <div id="show"></div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.