I am trying to call a function using ajax from a page which has a
request arg. the api is not getting called. Same api gets called if I
don't use request.args
here is my code

<div id="ajaxCallEval" style="display: none;"></div>
<form action="">
    <input type="hidden" id="pageId" value="-1" />
</form>
{{if request.args:}}
    <p style="cursor: pointer;"
onclick="jQuery('#pageId').val('{{=request.args[0]}}');
                                        ajax('pageAjax', ['pageId'],
'ajaxCallEval');" >{{=request.args[0]}}</p>
{{else:}}
    <p style="cursor: pointer;" onclick="jQuery('#pageId').val('10');
                                        ajax('pageAjax', ['pageId'],
'ajaxCallEval');" >10</p>
{{pass}}

and default.py

def pageAjax():
    """
    """
    print 'inside pageAjax with pageid %s' %request.vars.pageId
    return

if I click on <p> element from /default/index, control goes inside
pageAjax and line is printed as expected, however similar click on /
default/index/10 does not print anything on console. In both cases
firebug console shows ajax call as being successful.

Please advice.

Reply via email to