Hello,
I’ve made th change you sugested and stays the same. I know that the function segunda() is runs because I can see the 'ccccc' printed on the python shell. I think it probably as to do with the Ajax call, but I do not know why. Ricardo Sábado, 6 de Julho de 2013 15:15:27 UTC+1, LightDot escreveu: > > Like I said, your redirect is wrong. Should be f='segunda' not > f='segunda.html'. The 'index' shows because you're redirecting to a > non-existing function 'segunda.html' and the default 'index' is shown > instead. You must redirect to a function, not to a view. > > Regards, > Ales > > On Saturday, July 6, 2013 4:06:55 PM UTC+2, [email protected] wrote: >> >> Hello all and thank you for your replies, >> >> The work flow of the application is as follows: >> >> 1 - the index() functions calls index.html >> >> 2 – in index.html the user inserts his address and a JavaScript (Distance >> Matrix Service from google maps API) function is called. As the function >> has an asynchronous callback and I want the information for later use on >> the server side, I send the returned variables to the result2() function >> using an Ajax call inside de callback function: >> >> $.ajax({ >> >> type: 'POST', >> >> url: '{{=URL('default', 'result2')}}', >> >> data: JSON.stringify({dist: distArrayjs,dura: duratArrayjs}), >> >> dataType: 'json'} >> >> }); >> >> 3- when the asynchronous callback finishes the result2() functions runs >> and redirects to the segunda() function. The segunda() function will >> perform some calculation with the data and present the results to the user >> in segunda.html. >> >> All this is working until the redirection part. It should send me to >> default/segunda.html but instead it just show the starting index.html >> page. If I write the url default/segunda.html I can see the correct >> information. >> >> Thank you once again >> >> Ricardo >> >> Sexta-feira, 5 de Julho de 2013 22:47:36 UTC+1, LightDot escreveu: >>> >>> You also probably wanted >>> >>> redirect(URL(c='default',f='segunda')) >>> >>> without the .html in the name of the function. Besides this, I can only >>> repeat the question others have put - what's in the view? >>> >>> Regards, >>> Ales >>> >>> >>> On Friday, July 5, 2013 2:36:34 PM UTC+2, [email protected] wrote: >>>> >>>> Hello all, >>>> >>>> I’ve made a post before but did not receive any answers, so I will try >>>> to explain my problem I little better hoping that someone knows the answer. >>>> >>>> I have a controller function the redirects to another one: >>>> >>>> def result2(): >>>> >>>> print 'BBBBB' >>>> >>>> session.temparray2 = json.loads(request.body.read()) >>>> >>>> print session.temparray2 >>>> >>>> redirect(URL(c='default',f='segunda.html')) >>>> >>>> return dict() >>>> >>>> >>>> >>>> def segunda(): >>>> >>>> print 'ccccccc' >>>> >>>> return dict() >>>> >>>> >>>> >>>> I thought that, running result2() would present the segunda.html view >>>> to the user, but instead it does not. The segunda() functions runs, >>>> because >>>> I can see the printed ‘cccc’ on python window, but no web page is >>>> presented. Any one knows why the 'default/segunda.html’ is not shown? >>>> >>>> Thank you in advance >>>> >>>> Ricardo >>>> >>>> >>>> >>>> >>>> >>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

