By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

Pushing a PHP variable through Ajax

P: 33
ok this is pretty simple, im just up against a wall here, forgotten a little bit of things. i have a script below, and i calls to the php file, but i need to push an 'id' variable through the ajax function so that the other php file will know what the variable is... i know im staring at the answer just have had no luck, thanks

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function fetch(){
  3.     $.ajax({
  4.         url: 'fetch.php',
  5.         success: function(data){
  6.             $("#list").prepend(data);
  7.             if($("#list p").length > 20){
  8.                 $('#list p:gt(19)').remove();
  9.             }
  10.             $("#list p").fadeIn();
  11.             setTimeout("fetch()", 5000);
  12.         }
  13.     });
  14. }
  15. $(function(){
  16.     fetch();
  17. });
  18. </script>
May 25 '12 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
you have to define the data parameter for that (ref.)
May 25 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.