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