accessing javascript variables within psp code

Daniel no at no.no
Tue Jul 17 23:28:00 EDT 2007


On Wed, 18 Jul 2007 04:29:27 +0300, BAnderton <blake.anderton at gmail.com>  
wrote:

>
> Hello all,
>
> Question:  Is there any way to access a javascript variable from
> within psp code?
>
>
> I'm aware of how to do the reverse of this (js_var='<%=psp_var%>').
>
>
> Here's a non-working example of what I'm trying to do:
>
>
> - - - (begin example) - - -
>
>
> function Test(txt)
> {
> a = confirm('Are you sure you want to delete '+txt+'?')
> if (a)
> {
> //The problem is getting the value of js variable 'txt' recognized in
> "psp space".
> <%
> os.remove(  os.path.join(os.path.dirname(req.filename), '../notes/'+
> %>txt<%)  )
> %>
>
>
> }
> }
>
>
> - - - (end example) - - -
>
> FYI, I've already found a workaround for the above example (by placing
> a "get" variable in the URL, reloading the page, and having psp check
> for the existence of that variable before proceeding with deleting the
> appropriate file) but I'd still like this general capability for
> future projects.  I've searched several forums, websites, etc. and
> the
> answer has aluded me for two days now.  I'm new to apache, mod_python,
> and javascript, so this may be ridiculously simple.
>
> Since this is my first post on google groups, I'd also appreciate any
> helpful suggestions on how to best go about getting answers quickly
> (so let me know if there's a more appropriate forum/method/etc.)
>
> Thanks for any help you can provide.
>
>
>
> (This is copied from a message I originally posted to the mod_python
> group.)
>

Only with ajax.



More information about the Python-list mailing list