[jQuery] Re: how can I call php function in jquery ?

2009-04-02 Thread Alexandre Plennevaux
you'd send to your ajax.php script a value that it can process such as

ajax.php?do=deletecommentid=5

then your ajax.php :

switch($_GET['do']){
case 'delete':
// check for an id, delete it
break;

default:
// do nothing;
break;
}



On Thu, Apr 2, 2009 at 3:11 PM, dziobacz aaabbbcccda...@gmail.com wrote:

 I have in PHP file ajax.php:
 class Data
 {

        public function __construct()
        {
                
        }

        public function select($idl)
        {
                
        }

        public function delete($id)
        {
                .
        }
 }


 My jquery function looks now:
 function deleteComment(id)
 {
        $.post(ajax.php,
                {

                },
                function(data) {
                    ...
                }
        );
 }

 How can I in function deleteComment(id) call php function delete($id)
 from file ajax.php ?


[jQuery] Re: how can I call php function in jquery ?

2009-04-02 Thread dziobacz

THX very much Alexandre :)

On 2 Kwi, 15:19, Alexandre Plennevaux aplennev...@gmail.com wrote:
 you'd send to your ajax.php script a value that it can process such as

 ajax.php?do=deletecommentid=5

 then your ajax.php :

 switch($_GET['do']){
 case 'delete':
 // check for an id, delete it
 break;

 default:
 // do nothing;
 break;

 }
 On Thu, Apr 2, 2009 at 3:11 PM, dziobacz aaabbbcccda...@gmail.com wrote:

  I have in PHP file ajax.php:
  class Data
  {

         public function __construct()
         {
                 
         }

         public function select($idl)
         {
                 
         }

         public function delete($id)
         {
                 .
         }
  }

  My jquery function looks now:
  function deleteComment(id)
  {
         $.post(ajax.php,
                 {

                 },
                 function(data) {
                     ...
                 }
         );
  }

  How can I in function deleteComment(id) call php function delete($id)
  from file ajax.php ?