Discussion:
php side code for jQuery
Ricardo R Bonfim
2014-05-19 20:30:52 UTC
Permalink
You could either send information about which function you would like
to call on the url parameter ($_GET)

$.ajax('myserver.php?function=ajaxRetrieveData');

or adding into data object ($_GET or $_POST) :

$.ajax({
type: "POST",
url: "myserver.php",
data: { function: 'ajaxRetrieveData' }
});

and then using a router to find the function

myserver.php
$function = $_POST['function'];
$object->$function();

Please, do not use this code without properly validation.
I use following code for jQuery.ajax to call php.
$.ajax('myserver.php")
It seems that one php file only work for one jquery ajax code,
Is it possible to have more than one function or one return different
result in one php file?
Your information and help is great appreciated,
Regards,
Iccsi,
--
Att,
____________________________________________________
Ricardo R Bonfim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ICCSI
2014-05-19 20:40:11 UTC
Permalink
Thanks a million for the information and help,

Regards,

Iccsi,
Post by Ricardo R Bonfim
You could either send information about which function you would like
to call on the url parameter ($_GET)
$.ajax('myserver.php?function=ajaxRetrieveData');
$.ajax({
type: "POST",
url: "myserver.php",
data: { function: 'ajaxRetrieveData' }
});
and then using a router to find the function
myserver.php
$function = $_POST['function'];
$object->$function();
Please, do not use this code without properly validation.
I use following code for jQuery.ajax to call php.
$.ajax('myserver.php")
It seems that one php file only work for one jquery ajax code,
Is it possible to have more than one function or one return different
result in one php file?
Your information and help is great appreciated,
Regards,
Iccsi,
--
Att,
____________________________________________________
Ricardo R Bonfim
ICCSI
2014-05-19 20:21:28 UTC
Permalink
I use following code for jQuery.ajax to call php.

$.ajax('myserver.php")

It seems that one php file only work for one jquery ajax code,
Is it possible to have more than one function or one return different
result in one php file?

Your information and help is great appreciated,

Regards,


Iccsi,

Loading...