jQuery (and most Javascript AJAX libraries) automatically sends the
request header:
X-Requested-With: XMLHttpRequest
You don't have to do anything for that.
If you use something like Firebug for Firefox you can see these
headers being sent and returned.

On the PHP side, you can use the follow code to retrieve header
values:
$_SERVER['HTTP_X_REQUESTED_WITH']
(do a print_r($_SERVER) to find these things)

You'd probably do something like this:
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER
['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
    // do something
}


On Aug 29, 9:37 am, Danny <bad.ch...@gmail.com> wrote:
> I understand that ive to use - X-Requested-With then I did search a
> bit about that and I found this code,
>
>  $.ajaxSetup({
>       headers: {"X-Requested-With":"Ajax"}
>     });
>
> but I still don't understand how should I send the parameters to the
> same file and get them in the server side (PHP)
> I hot to get answer,
>
> thanks!

Reply via email to