Yes, that's what's happening: X-Requested-Header is not being sent when
I manually use $.web2py.ajax_page(...) in my HTML.


Niphlod wrote:
> I'm missing a point ..... the only "reliable" way to detect a request
> cming from ajax is indeed the presence of the x-requested-with header
> ..... are you saying that you can replicate consistently a behaviour
> where jquery doesn't add the x-requested-with header ?
>
> Il giorno giovedÄ› 19 settembre 2013 08:05:46 UTC+2, Kurt Grutzmacher
> ha scritto:
>
>     Changeset a51d0877979c0846b420bee31102d162030f79ca in
>     gluon/main.py now
>     checks for response.ajax being true before adding response headers
>     for
>     web2py-component-flash and web2py-component-command. Unfortunately
>     calls
>     manually utilizing web2py_ajax_page( ... ) are not being seen as
>     "ajax"
>     because jQuery does not send the X-Requested-With header.
>
>     For instance in the I have this this:
>
>     var data = "article=" + checks;
>     url = "{{=URL('hosts', 'delete.json', user_signature=True)}}"
>     $.web2py.ajax_page( 'POST', url, data );
>
>     If I look at the request headers being send, X-Requested-With is not
>     set. Ajax calls that are set up by web2py functions such as LOAD(..,
>     ajax=True) seem to be ok.
>
>     This is acting like jQuery believes I'm sending a cross-domain ajax,
>     which would should not send the header.
>
>     A work-around can be done by setting both the
>     response.flash/response.js
>     entries as well as the corresponding header entries but that seems
>     counterintuitive since main.py/wsgibase <http://main.py/wsgibase>
>     should be setting these accordingly.
>
>     -- 
>     - grutz;
>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
- grutz;

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to