Ok, the IT guy has disabled McAffee's "on access" scan for the folders 
containing web2py stuff as well as python's installation directory. He 
tells me that parts of McAffee other than "on access" scan may still 
interfere but there's not much we can do about that. This hasn't made any 
difference.
As for the ajax calls, I thought it might be to do with the asynchronous 
calls taking too long when the server is overloaded (and it seems it is 
being hammered intermittently by another application), but I checked my 
web2py_ajax.html file and the ajax function is set to "async: false", so 
there shouldn't be an issue there unless there is some kind of timeout that 
kicks in?

But.... I was about to post the above when I did some checks on the ajax 
calls, and am a bit confused...
I have two javascript functions which call ajax:

#Function1:  This call displays a check list of 'previous contracts' to 
pick from
ajax('HubForms/Timesheets/AjaxReturnBlank', [], 
'PreviousContractListingArea');

#Function2:  Once user has check some items, they click a button to call 
this, which adds all selected contracts to timesheet, then reloads the page.
jQuery('.PreviousContractCheckbox').each(
    function(index)
    {
    if(this.checked)
        {
        jQuery('#ContractId').val(this.name);
        ajax('HubForms/Timesheets/AjaxAddContractToTimesheet', 
['ContractId', 'TimesheetId', 'UserId']);
        }
    }
    );
a='nothing, just works';
window.location='HubForms/Timesheets/ViewTimesheet?Timesheet_Id=15995';
location.reload(true);

I temporarily modified the ajax function in web2py_ajax.html to display a 
pop-up, then wait 3 seconds before executing (last 4 lines modified):

 function ajax(u,s,t) {
  var query="";
  for(i=0; i<s.length; i++) { 
     if(i>0) query=query+"&";
    
 
query=query+encodeURIComponent(s[i])+"="+encodeURIComponent(document.getElementById(s[i]).value);
  }
  /*this line:
       jQuery.ajax({type: "POST", url: u, data: query, async: false, 
success: function(msg) { if(t==':eval') eval(msg); else 
document.getElementById(t).innerHTML=msg; } }); 
  replaced by these 4 lines:
  */
  alert('hi');
  setTimeout(function(){
  jQuery.ajax({type: "POST", url: u, data: query, async: false, success: 
function(msg) { if(t==':eval') eval(msg); else 
document.getElementById(t).innerHTML=msg; } })
  },3000);  
}

The funny thing is that my Function1 does this (says 'hi' then pauses for 3 
seconds), but Function2 says 'hi' for every item selected as you'd expect, 
but does NOT pause...
This is making me wonder whether web2py's ajax function behaves differently 
when called from inside jQuery().each() as the setTimeout() is being 
ignored...? 
If that is the case then perhaps the directive to use "async: false" is not 
being taken into account in this scenario?

Any javascript knowledgeable people able to help on this one?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to