views:

22

answers:

2

i use this code :

$(document).ready(function() {

                        $.ajax({
                              url: 'server.php',
                              type: 'POST',
                              data : {temp : '100'},
                              success: function(data) {
                                alert('Load was performed.');
                            }   
                    });

    });

and just want to take the value of temp at the server.php file and print it , what im doing is $_POST['temp']; but dont have results

+1  A: 

On the PHP end, you need to actually output that by passing it to echo:

echo $_POST['temp'];
Jacob Relkin
im doing echo ..just like u wrote it down..but as i guess the value dont "stays" in the php file...i guess this is ajax ...send some data to perform some operation the php file and then the data are back..so i cant print the value...
t0s
A: 

Try this

$(document).ready(function() {

                    $.ajax({
                          url: 'server.php',
                          type: 'POST',
                          data : "temp=100",
                          success: function(data) {
                            alert('Load was performed.');
                        }   
                });

});
Fincha
data : {temp : '100'}, thats how it finally worked...thnx
t0s
what have you changed?
Fincha