uhm. I open default/index and I see two buttons. the first works, the
second doesn't (a problem in trap_form()), but for both xmlhttprequest is
there.
Are you sure of what you're reporting ?
BTW: was it documented that ajax_page supports not having a target ? I can
patch it for '' and undefined, but I'm not sure where you found that
reference. Anyway it's not a big deal, I'll send a PR (just dealing with
the error, as I can't reproduce the missing xmlhttprequest)
PS: if every user learns from you on how to report bugs life for devs would
be much sweeter: thanks for your accuracy ^_^
On Thursday, September 19, 2013 1:48:46 PM UTC+2, Kurt Grutzmacher wrote:
>
> Hey Niphlod,
>
> Further testing shows this happens only when the $.web2py.ajax_page()
> call has an undefined target:
>
> request.ajax = False: $.web2py.ajax_page( 'POST', url, 'data=data' );
> request.ajax = True: $.web2py.ajax_page( 'POST', url, 'data=data', ''
> );
>
> Packed test application attached
>
> Niphlod wrote:
> > can you pack an app that shows the problem ? I really can't replicate
> > the issue ... AFAIK jquery adds it unless an upload field is submitted
> > or when fetching a script or a json.
> >
> > Il giorno gioved� 19 settembre 2013 09:34:36 UTC+2, Kurt Grutzmacher
> > ha scritto:
> >
> > 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> <http://main.py/wsgibase>
> > > should be setting these accordingly.
> > >
> > > --
> > > - grutz;
> > >
> > > --
> > > Resources:
> > > - http://web2py.com
> > > - http://web2py.com/book (Documentation)
> > > - http://github.com/web2py/web2py
> > <http://github.com/web2py/web2py> (Source code)
> > > - https://code.google.com/p/web2py/issues/list
> > <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] <javascript:>.
> > > For more options, visit https://groups.google.com/groups/opt_out
> > <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] <javascript:>.
> > 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.