The problem is that by the time you are trying to modify the href
parameter, the browser has already evaluated the location of the link.
You will either need to use the preventDefault() method to stop the
link from going through, or you can change the link before the click
takes place.
One way to accomplish that might be to change the parameter in the
onhover and then subsequently after every click. This would set the
values for the next click and not the current click. You could use
$('#PDFLink').data("token", token) to add an HTML5 data-token attribute
to your href and retrieve the token to check with var token =
$('#PDFLink').data("token").
The other way to do this would be to create a response with a content
type of 'application/pdf' that would stream the pdf file back to the
browser. You would then set the window.location to the appropriate url
and when the browser sees the proper content-type, it will kick off the
save dialog. This would be my preferred method instead of trying to
create a potentially fragile jQuery solution.
Jason
On Wednesday, June 26, 2013 12:55:38 PM, ras5429 wrote:
> I have a CSP page that allows a user to select/enter some parameters
> and generate a Zen Report. The HTML is displayed immediately in the
> browser. If the user wants to generate a PDF, they can click a button
> to do so.
>
> *_This 'button' is actually a link:_*
>
> <a
> href="/csp/mynamespace/MyApp.DLF*i*le.cls?file=#(reportName)#&token=#($username)#">
> <img src="PDFimage.png" >
> </a>
>
>
> *_That will call this class_*
> * I want to add a unique token by appending the username with the
> exact time
> * I need to modify the href for my link to include this time (so I
> can pass it to the class and retrieve it via %request)
> * Whenever the href is modified (after the link is clicked), the
> cookie is never returned from DLFile.cls
> * I also need to capture the token value before invoking DLFile.cls
> so that my JQuery function can ensure that the returned cookie
> value matches what it's expecting
> * I attempted to modify the href in several ways:
> o In the HTML href definition
> o Via a javascript function (i.e. href="javascript:modifyLink()")
> o In my JQuery function (shown below) that initializes the timer
> --
> You received this message because you are subscribed to the Google
> Groups "InterSystems: Zen Community" group.
> To post to this group, send email to
InterSys...@googlegroups.com
> To unsubscribe from this group, send email to
>
InterSystems-Z...@googlegroups.com
> For more options, visit this group at
>
http://groups.google.com/group/InterSystems-ZEN?hl=en
> Zen Community Terms and Conditions:
>
http://groups.google.com/group/InterSystems-ZEN/web/community-terms-and-conditions
> ---
> You received this message because you are subscribed to the Google
> Groups "InterSystems: Zen Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
intersystems-z...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>