hello i think i'm missing something here... I have that script on my html page
12 <script type="text/javascript">
13 $(document).ready(function() {
14 $('#find').click(function(){
15
16 var amount = $('#amount').val();
17
18 $.ajax({
19 type: "POST",
20 url: "questions.php",
21 data: amount,
22 success: function(data){
23
24 $('#results').show();
25
26
27 $('#results').html(data);
28 }
29 });
30 });
31 });
32 </script>
if i alert amount i get the input so the value works fine
and here is my php script
<?php
2 $search_term = $_POST['amount'];
3
4
5
6 echo $search_term;
...
so i get nothing as a result! if i change the echo thing to "mpla mpla"; everything works fine?
Am l missing something?
thanks in advance!
data
is meant to be a map of keys and values.
Try:
data: {amount: amount}
$(document).ready(function() {
14 $('#find').click(function(){
15
16 var amount = $('#amount').val();
17
18 $.ajax({
19 type: "POST",
20 url: "questions.php",
21 data: { 'amount': amount },
22 success: function(data){
23
24 $('#results').show();
25
26
27 $('#results').html(data);
28 }
29 });
30 });
31 });
Change it into this. This will pass the variable 'amount' as $_REQUEST['amount']