ok cool.. understood.. so how would i send variables to a function in
the controller?

On May 5, 10:49 pm, Anthony <[email protected]> wrote:
> ajax('{{=URL('insert_updatedb')}}',
> ['numBer','mgp','total_time','correct'],'');
>
> The above will not send the values of your variables as request variables.
> The list submitted to the ajax() function is supposed to be a list of field
> IDs (seehttp://web2py.com/book/default/chapter/10#The-ajax-Function). It
> does not appear you have created fields with those IDs. You might be able to
> add the variables to the URL function, though.
>
> On Thursday, May 5, 2011 9:44:47 PM UTC-4, Resa wrote:
> > I am having huge issues with the parameters cause they are not being
> > sent to the function at all...
> > 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
> > .
> > .
> > .
>
> > On May 5, 8:37 pm, Resa <[email protected]> wrote:
> > > Correction:
> > >  function MGP(correct)
> > >     {
> > >         var time_per_question=2;                         //2 second to
> > > answer one question
> > >         var numBer={{=request.vars.number}};               // the
> > > number of questions in worksheet
> > >         var bonus= (numBer<20)? 1: (numBer<40)? 3 :(numBer<60)? 7:
> > > (numBer<80)? 9: (numBer<100)? 11 :13    // calculate bonus
> > >         var total_time=converttime();
> > >         var mgp= (((correct/numBer)+(total_time/
> > > (numBer*time_per_question))+bonus));
> > >         ajax('{{=URL('insert_updatedb')}}',
> > > ['numBer','mgp','total_time','correct'],'');
> > >      }
>
> > > On May 5, 7:35 pm, pbreit <[email protected]> wrote:
>
> > > > This is pretty confusing code.
>
> > > > I'm not sure how these assignments are going to work:
> > > > {{=numBer}}=numBer
> > > > ...
>
> > > > Normally you have something like num={{=row.num}}
>
> > > > In the dict() it looks like you are assigning strings. Normally it
> > would
> > > > look more like this dict(numBer=numBer,...)
>
> > > > You definitely don't want this: {{URL(...    That's not going to do
> > > > anything.
>
> > > > Then you need something to trigger the Ajax call.
>
> > > > Review the Book:
> >http://web2py.com/book/default/chapter/10#The-ajax-Function
>
> > > > I would suggest starting very simply, prove that it works and then add
> > the
> > > > complexity.
>
>

Reply via email to