[Grok-dev] jQuery Ajax and Grok
Daniel Lyons
fusion at storytotell.org
Sun Jul 11 03:39:51 EDT 2010
Hi,
Forgive me if this is an obvious question. I'm working through the excellent book "Grok 1.0 Web Development." I have used many frameworks on many platforms and the one constant since about 2008 for me has been jQuery. Everything seems to be working great except I am not sure what to do to make jQuery aware of the URLs that Grok is generating. As an example from the book, there's this code:
<input type="checkbox" tal:define="check_url python:view.url('check')" tal:attributes="onclick string:checkItem('${check_url}?list_index=${repeat/todolist/index...
In my code, to make things unobtrusive, I have the following:
<input class="check" type="checkbox" name="items:list" tal:attributes="checked item/checked"/>
Then in my todo.js file I have some code that basically looks like this:
$('.check').change(function(e){
$.get('check'...
});
What's bugging me is that I have hard-coded 'check' URL in the jQuery. I'd rather use Grok's URL, but I'd like to remain unobtrusive. Is there a good solution to this problem?
Thanks,
—
Daniel Lyons
More information about the Grok-dev
mailing list