Hi,

You can use data properties, for example:

# Template

<div id="my_container" data-url="{{ url_endpoints param }}">
</div>

# Javascript

$('#address').editable({
    type: 'text',
    url: $('#my_container').data('url'),
    ......
});

Hope this helps,

On Sat, Jan 26, 2013 at 8:54 AM, Jason <1jason.whatf...@gmail.com> wrote:

> Hi there.
>
>
> I am moving some javascript from my html to an external js file. At present 
> however, whenever my pages are rendered I use variable names to give url 
> endpoints, for example:
>
>
>     $('#address').editable(
>         {
>             type: 'text',
>             send : "always",
>             url: '{{ url_endpoints.logged_in_change_address }}', // the 
> variable value becomes something like /au/change_address
>             title: 'Enter kindle address',
>             success: function() {
>                 window.location.reload();
>             }
>         }
>     );
>
>
> However, in moving the js to the external file, when rendering the html
> page the variable values are no longer mapped to the variable name within
> the external js file. The information is still there, I was just wondering
> if I could somehow pull in the variable values without declaring global
> variables or hardcoding the urls in the js?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Juan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to