On 9/19/2010 12:52 PM, Ben Kraft wrote: > I'm trying to do a javascript post to an internal api and use a > callback to process the JSON result. I'm referencing the api using, > > {% url %}, > > which returns a path url relative to my domain ( /api/... instead of > http://localhost/api/... for the dev site). > > The problem is js does not recognize that the relative / path url > returned by {% url %} is on the same domain current page, and refuses > to execute the callback. I could mess around with JSONP, but I'd > rather just put the full url in the template. Is there a convenient > way to do this, or am I missing something? I could just add manually > add the full url to the request context, but it seems like everyone > who uses django with JS callbacks would have this problem, and there > should be a simpler way. > > -Ben > (and I'm sure the sites are on the same domain -- if I hardcode the > full url, the callback works fine). > SERVER_NAME and SERVER_PORT are available in HttpRequest.META if you want to construct full URLs.
regards Steve -- DjangoCon US 2010 September 7-9 http://djangocon.us/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.