Hi all...
*EDITED THIS QUESTION FOR CLARITY*
I have a Django template with a flash object in it. The template itself inherits from the main template and is in a block called info. Everything works ok with that!
When the flash object is clicked it calls a JavaScript callback function, with a parameter, in a separate js file. Within this function I can load another Django template by using something like
function myCallBack(param){
location.href = 'crc_region_cities' // (Django url).
}
What I want to know is how do I pass the parameter param (which is a string) to that URL so that the view function of the same name: def crc_region_cities picks it up and does the appropriate query..
Extra info:
The new URL calls a view which renders a template, which again inherits the same main template as the previous template and resides in the same block...info.
Is there a better way to do this...?? Remember that my flash object calls a javascript callback function with a string parameter,so I have to maneuver from there somehow to the new template whilst passing the string parameter to the URL. Below in the code you can see the second parameter of the view function is called region. This is the parameter I need to pass in via javascript function.
THE URL (r'^crc_region_cities/?$', 'crc_region_cities'),
The View
def crc_region_cities(request, region):
cities = City.objects.filter(region__exact=region)
return render_to_response('crc/crc_region_cities.html', {'cities': cities}, context_instance=RequestContext(request))
Many Thanks