what i am exactly trying to do is to send the data that i have
processed from my javascript and send it to the controller
function - insert_updatadb()
function MGP(correct)
{
time_per_question=2 //2 seconds per question
var numBer={{=request.vars.number}} / number of question in worksheet
var bonus= (numBer<20)? 1: (numBer<40)? 3 :(numBer<60)? 7
:(numBer<80)? 9 :(numBer<100)? 11 :13 // calculate bonus
total_time =converttime()
var mgp= (((correct/numBer)+(total_time/(numBer*0.3))+bonus))
{{=URL(f='insert_updatedb', vars={
'number':numBer,'totaltime':total_time,
'mgp':mgp,'correct':correct})}}
OR
ajax(' {{=URL('insert_updatedb')}}
',['numBer','mgp','total_time','correct'],'results')
}
however the URL is not working :
NameError: name 'numBer' is not defined
and the ajax when i try that one doesnt work
On Fri, Apr 29, 2011 at 6:56 PM, Massimo Di Pierro <
[email protected]> wrote:
> <a href="{{=URL(f='insert_updatedb', vars={'number':numBer,
> 'totaltime':total_time, 'mgp':mgp,'correct':correct,})}}">click me</a>
>
> or, depending on what you want,
>
> {{=LOAD(request.controller,'insert_updatedb', vars={'number':numBer,
> 'totaltime':total_time, 'mgp':mgp,'correct':correct},ajax=True)}}
>
> On Apr 29, 6:54 pm, Resa <[email protected]> wrote:
> > Controller:
> > def insert_updatedb():
> > session.correct=request.vars.correct
> > session.numquest=request.vars.number
> > session.time_quest=request.vars.total_time
> > session.mgp=request.vars.mgp
> > .
> > .
> > .
> >
> > in a script in a view:
> > {{URL(f='insert_updatedb', vars={'number':numBer,
> > 'totaltime':total_time, 'mgp':mgp,'correct':correct,})}}
> >
> > why doesn't the url work?
>
--
~~~~Live Laugh Love || Strength, Courage and Wisdom ~~~~