[support] AJAX

Jamie Holly hovercrafter at earthlink.net
Wed Oct 23 15:50:42 UTC 2013


A PDF is also static. The controls for the PDF doesn't come from code 
you put in, but rather from the mimetype handler on the user's browser 
and the associated viewer/plugin (ie - Adobe Reader, Chrome's PDF 
viewer, etc.). Same thing as clicking a link to an MP3 and your 
browser's audio player opens, so long as your browser has a handler 
associated with the MP3 mime-type.

What you are going to need is some browser method of displaying a PDF 
within the browser, like FlexPaper, so you control the viewing 
mechanism. That you can load into a Colorbox through regular inline DOM 
or an iFrame. Even then you still got extra work to do, either using 
FlexPaper's desktop publisher or server side (which means having a VPS 
or dedicated server so you can install the needed software).

You can also load the PDF via an iFrame in Colorbox, meaning the native 
PDF viewer in the browser will take over. That would be the easiest 
route, but also the one with the least amount of control.


Jamie Holly
http://hollyit.net

On 10/23/2013 11:16 AM, Chris Miller wrote:
>
>     *From: *"Fred Jones" <fredthejonester at gmail.com>
>     *To: *support at drupal.org
>     *Sent: *Wednesday, October 23, 2013 4:22:17 AM
>     *Subject: *Re: [support] AJAX
>
>     This is actually what Colorbox already does. Probably that's all
>     you need:
>
>     https://drupal.org/project/colorbox
>
> I'll investigate this, because even if it doesn't work for the current 
> project, it will definitely work for the Photo Album part.  I 
> oversimplified the description of what I was displaying to avoid 
> misdirecting the conversation away for the aspect of AJAX.  I doubt 
> that colorbox will work for the true content which is a PDF.  A 
> picture is static, but a PDF needs controls like download and scroll bars.
>
>
>     If not, Google for "drupal ajax" and you will find the third result in
>     Google is an EXAMPLE of how to do it in Drupal, right on the Drupal
>     API site:
>
>     https://api.drupal.org/api/examples/ajax_example!ajax_example.module/group/ajax_example/7
>
> This would be some of the MANY articles I've read.  They do not 
> explain the questions I have.  I am sure there will come a day when I 
> can read this and completely understand it but right now it does not 
> explain things usefully. I've read it many times and I have not been 
> able to produce anything useful, which is why I am asking questions.
>
>
>     > More specifically, how does 'class="use-ajax" ' do this magic?
>      I have to
>     > assume there is an onClick event handler hiding somewhere above
>     me in the
>     > DOM looking for the class "use-ajax".  Where is this event listener
>     > attached? How does it become attached?  Where is the source, so
>     I can see
>     > both the event handler and the attachment?
>
>     To understand the basics of Ajax if you prefer to do it yourself,
>     start with a tutorial. Here's one I found on Google:
>
>     http://www.w3schools.com/php/php_ajax_intro.asp
>
> I understand the basics of AJAX, and I've used it before. What I DON'T 
> understand is how to use AJAX withing the confines of Drupal, which is 
> not an AJAX question, but a Drupal question.
>
>
>
>     > Finally, how do I register my callback function which will
>     operate on the
>     > returned JSON, which is a complicated question because I need an
>     example of
>     > what I need to write, where I need to put it, and how I tell
>     Drupal that it
>     > is there.
>
>     Google for "register ajax callback" and the first result is:
>
>     http://api.jquery.com/ajaxComplete/
>
> This is a jQuery call, which is fine, but I have found no Drupal 
> documentation that says to make this call.  So, this is also not 
> illustrative.
>
>
>
> I appreciate that you tried to help, but I still have many questions.  
> I did get a pointer from another source that sent me to 
> http://www.interactivejunky.com/tutorial/ajax-commands-drupal-7 which 
> has allowed me to create a minimal working example from which I can 
> increase my understanding through brute force experimentation and 
> intrusive debugging.  My recommendation to anybody following the path 
> I am on is to read this.
>
> Chris.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20131023/4b4e0a77/attachment.html 


More information about the support mailing list