You're probably getting an error in the JS console. The ajax() function
expects id to be a string, so try:
ajax('{{=URL('default','deciser')}}' + '?at=' + id, [], id.toString())
Anthony
On Saturday, June 11, 2016 at 11:41:40 AM UTC-4, Steve Joe wrote:
>
> It does nothing.
> However in
> function change(id)
> {
>
> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id);
> }
>
> when I change the second id to something '12' as in
> function change(id)
> {
>
> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],'12');
> }
> it works as expected. But when it id it doesn't show any response.
> Something's wrong there and I am unable to fix it.
> On Friday, June 10, 2016 at 7:35:39 PM UTC+5:30, Anthony wrote:
>>
>> In the browser network tab, what's happening with the Ajax requests? Are
>> they being sent as expected, and if so, what response is returned?
>>
>> On Friday, June 10, 2016 at 8:14:55 AM UTC-4, Steve Joe wrote:
>>>
>>> in .load file:
>>> {{for i in range(0,3):}}
>>> {{for j in range(0,3):}}
>>> {{idd=str(i+1)+str(j+1)}}
>>>
>>> <p id={{=idd}} style="display:inline" onclick=change({{=idd}})>
>>> {{=l[i][j]}}
>>> </p>
>>> {{pass}}
>>> <br>
>>> {{pass}}
>>> <script>
>>>
>>> function change(id)
>>> {
>>>
>>> ajax('{{=URL('default','deciser')}}'+'?at='+id,[],id);
>>> }
>>> </script>
>>>
>>>
>>>
>>> def deciser():
>>> return request.vars.at
>>>
>>> def addgameplay():
>>> l=[]
>>> temp=[]
>>> for i in range(0,3):
>>> for j in range(0,3):
>>> temp.append('__')
>>> l.append(temp)
>>> temp=[]
>>> return locals()
>>>
>>>
>>> in the function where .load has to run:
>>> {{extend 'layout.html'}}
>>> {{=LOAD('default', 'addgameplay.load', ajax=True)}}
>>>
>>> def gameplay():
>>>
>>> return locals()
>>>
>>>
>>>
>>> *It does nothing! It doesn't update the id. I did some debugging and
>>> found that the id isn't passing correctly! How do I correct this?!*
>>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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/d/optout.