Synchronous versus Asynchronous Ajax calls

Hello Apex gurus,
I have a page which uses synchronous Ajax and seems that once in a while the browser freezes. I suppose this happens when the server takes a little longer to respond. I read this article:
http://www.oreillynet.com/xml/blog/2007/01/do_sync_calls_freeze_browsers.html
and I wanted to reproduce the test. So at the top of my on demand process I put
DBMS_LOCK.sleep(10);
I expected this to freeze the browser for about 10 sec but make no difference in terms of what the response is.
It seems though that the response is null. I also have:
EXCEPTION
WHEN OTHERS THEN
htp.p(SQLERRM);
to capture any errors but no error message is returned either.
Can somebody explain what is going on here and as a second question: if I make the synchronous call to asynchronous is this going to solve the browser freezing problem.
George

Hello,
Please check if the following can help you –
Re: Ajax and Threading
Re: spinning/loading image for ajax call
Regards,
Arie.

Similar Messages

  • What is synchronous and asynchronous FM calls

    Hi All,
       Can you tell me that what is synchronous and asynchronous FM calls?
       Full points will be rewarded for the answer of this simple question !!
    Best Regards,
    Chandan Dubey

    Hi Chandan,
         You can refer the below document for a good explanation.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f078394a-4469-2910-c4bf-853c75674694
    Thnaks,
    Siva.

  • Asynchronous BLS Call

    Hi Everybody
    Can we call BLS from another BLS or from Irpt/html as Asynchronously. I have the requirement where in it doesn't matter the step executes or not . And that particular step is inserting data into table so its taking long time execute.
    So, wondering whether I can execute BLS transaction asynchronously..
    Let me know if any body doesn't understand my question.
    Thanks
    Hari

    Hi Hari,
    Sure you can.  Here is a bit of an extreme example, maybe, using jQuery's ajax method.  This JS function basically creates an Employee object from a asynchronous call to a BLS transaction where I pass in an employee's identification.  Actually, this is a non-asynchronous AJAX call for reasons to large for this post.  But, if you are going to use jQuery you can set the async to true or omit it (as it is the default). 
    function Employee(employeeId) {
         var theEmployee = {};     
         if(employeeId != "") {
              var urlForEmployeeInfo = '/XMII/Runner?Transaction=SomeCompany/Production/GetOperatorInformation&Employee='+employeeId+'&OutputParameter=EmployeeXML';
              $.ajax({
                      type: "GET",
                      url: urlForEmployeeInfo,
                      async: false,
                      success: function(data){
                        if($(data).find('FatalError').text() == "") {
                             if($(data).find('Messages').text() == "") {
                                  if ($(data).find('EmpNo').text() != '') {
                                            theEmployee.firstName = $(data).find('FirstName').text();
                                       theEmployee.lastName = $(data).find('LastName').text();
                                       theEmployee.fullName = $(data).find('FullName').text();
                                       theEmployee.error = '';
                                  } else {
                                       theEmployee.error = 'Invalid Employee';
                             } else {
                                  theEmployee.error = $(data).find('Message').text();
                        } else {
                             theEmployee.error = $(data).find('FatalError').text();
         return theEmployee;
    Of course, you don't need the jQuery library to make an AJAX call to a BLS transaction.  It was just code I had handy.

  • Call mode types: Synchronous and Asynchronous in ABAP process for a chain

    Hello,
    I have a doubt about the call mode type for a abap type process in a process chain. It has two options:
    1.Synchronous
    2.Asynchronous
    Would like to know the diferences between these two; advantages and disadvantages of using them.
    Thanks in advance for your help...
    Regards,
    Anuj

    hi anuj,
    pls refer the following link.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c5/eed63b54e56276e10000000a11402f/content.htm
    hope it will help u to understand well the synchronous and asynchronous process chains call mode.
    thanks

  • What is a gateway proxy?? what are synchronous and asynchronous calls?

    bapis are rfc enabled. but are there any other rfc's  available in sap? what is a gateway proxy?? what are synchronous and asynchronous calls?

    Hello:
    Lets st art at the beginning.
    There are NO documented viruses that affect a Mac running OS X - none (there are instances of Malware).
    Gateway GEO-IP/BOTNET Alert
    This is a Youtube video that explains what you have (I assume you installed it somehow) on your computer:
    http://www.youtube.com/watch?v=JwRi2me2hSk
    For openers, I would uninstall any A/V software you have put on your system.  It is certainly possible that that junk has put some other stuff on your computer.
    I'm also afraid my computer might have been hacked?
    Highly unlikely.
    Barry

  • In bdc call transaction method which one ll prefer synchronous or asynchron

    hi could anybody tel me
    call transaction method which one is preferred synchronous or asynchronous..?
    what ll happen if we do other method..?
    foreground or background which one ll prefer..?
    what ll happen if we do otehr method..?
    on which condition we have to use synchronous and asynchronous
    on which condition we have to use foreground and background
    thanx
    kals.

    Hi,
    if you haven't done yet please visit for general information:
    http://help.sap.com/saphelp_nw70/helpdata/en/d2/f8f3393bef4604e10000000a11402f/frameset.htm
    for further information:
    http://help.sap.com/saphelp_nw70/helpdata/en/69/c2501a4ba111d189750000e8322d00/frameset.htm
    This will hopefully answer your question.
    Regards
    Bernd

  • Is a call library function node in LabView 8.6 synchronous or asynchronous?

    I tried setting a sub-VI with a call library function node in it to "subroutine" execution status.  The error list indicated that the Call Library Function node in the block diagram was an asynchronous node.  The LabView on-line help content indicates
    "...CINs and shared libraries execute synchronously, so LabVIEW cannot use the execution thread used by these objects for any other tasks. "
    Does anyone know for sure what the status of a Call Library Function is?  Does it depend upon the specific code in the DLL being called?
    Thanks,
    Mike H.

    Based on the help page it looks like it should execute asynchronously.
    The thing in the description that leads me to believe they execute asynchronously is that you can configure the library to run as a multi-threaded operation.
    Please take a look here to see the difference between synchronous and asynchronous execution.
    Since the code even has the ability to be multi-threaded, you can consider it as running in parallel to your other code.
    Any data returned is passed to the thread that called that function.
    Cory K

  • Windows authentication on every ajax call MVC

    I've created an MVC project with windows authentication.
    From my views, I use Jquery to retrieve data from the controller asynchronously in order to provide a better user experience and reduce loading times.
    These functions look like
    public JsonResult someFunction(string parameter)
    return Json(result, JsonRequestBehavior.AllowGet);
    Everythings works as I want in Chrome, where it prompts me for login when I open the page and no more for the duration of that session. However, in IE, it prompts me for login when I open the page, and on every single ajax call...
    Why is this happening and how can I avoid it?
    I need to use windows authentication and IE, I can't change that...

    Hello,
    In order to get your issue solved more efficiently and since this is a MVC issue, I would recommend you post this issue in
    http://forums.asp.net/1146.aspx/1?MVC forum to get supports.
    Thanks for your understanding.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • MSIE vs. Firefox and asynchronous AJAX...is MSIE really NOT doing async?

    Apex v4.1
    MSIE v8.0 and Windows XP
    Firefox v6.0.2
    Background
    Sorry it's a lot but I figure giving all this context would help avoid tangental questions that could derail from my real question(s).
    I have a master-detail page where I have such business and functional requirements to do a lot of various validations, checking, disabling/enabling, etc. in the detail region. Given that detail regions in master-detail pages are nothing more than tabular forms that are filtered by the master record's PK and that tabular forms have limited validation and nonexistent calculation ability via declarative calculation processes, my detail region is immensely javascript heavy. In addition, I have the functional requirement that the user see all detail lines on the same page, so I cannot limit the page to 10-15 lines per page anyway.
    When the page loads, I need to do a number of functional things to the detail region before the page control is turned over to the user, such as:
    1. Disable certain columns that are saved as database columns but never touched by the user.
    2. Disable certain columns that the user does not have authorization to modify (but tabular forms have no "readonly" attribute for columns like page items do)
    3. Disable certain fields on a row (but not on all rows) based on business rules (e.g.: if PART_NO on a row is null, PART_SERIAL_NO on that row only needs to be disabled (as the user shouldn't be able to enter it).
    4. Etc., etc...you get the idea. There are just a lot of things that cannot be declaratively done to a tabular form column and also things that cannot be done on a row-by-row basis, hence the javascript.
    When the page loads, I also have to do two cosmetic things to the rows and these can be done after the control is turned over to the user since they are cosmetic only and do not affect their ability to be disabled out of a row-field combo, etc.:
    1. For one column that is a popup key LOV, override the displayed value with a different value than Apex generates from the LOV definition. In other words, the LOV definition is "a || b" for the display value and "c" for the return value, but on the main page the users want "a" for the display value that they see.
    2. For all records, evaluate several fields on a record and as a result, highlight certain other fields in red, yellow, or black via the background color.
    Everything is actually working in both MSIE and Firefox and I'm happy about that. However, the stuff I'm doing in the second group (the popup key LOV display field and the coloring of the background of fields) is only working nicely and quickly in Firefox but is super slow in MSIE. My worst-case scenario in testing is my master-detail has 281 detail rows and in Firefox it takes about 20-25 seconds to paint the page, give control to the user, and then finish doing the asynchronous AJAX stuff after that (which sems to also go quickly). In MSIE, my page rendering time ranges from 1 minute 30 seconds with the AJAX async stuff commented out and not even running to over five minutes (!) with the AJAX stuff left in and running. The difference of 4+ minutes also implies to me that the AJAX stuff is not running asynchronously (or if it is, something else is getting in the way of the effective purpose of it being asynchronous).
    Right or wrong, how I built my page is that since a lot of the Javascript code is to act on the detail region onlly, I defined the javascript in the region and not in the page just so that when the detail region isn't displayed (usually when a new master is being created), we don't even display or render any of the javascript.
    When the detail region does show, the Javascript that goes along with it to do all the work to the detail region rows/columns also runs.
    Example...this is in the region footer of the detail region:
    <script type="text/javascript">
    //Always when region loads
    //Initialize special processing on the fields on the lines that can't be done
    //elsewhere.
    if (window.addEventListener) // W3C standard
      addLoadEvent(InitDetailItems());
    else if (window.attachEvent) // Internet Explorer
      addLoadEvent(InitDetailItems);
    if (window.addEventListener)
      window.addEventListener('load', postLoad, false);
    else
      window.attachEvent('onload', postLoad);
    </script>When the detail region loads, I append a call to the onload event of the page so that the function InitDetailItems is called (addLoadEvent is just another wrapper that detects if the page even has an InitDetailItems function and if it does, it then adds a call to InitDetailItems to fire in addition to any other on-load processing). I did it this way as a matter of style such that if a developer added any onload at the page header that this would just be appended to it. This call to addLoadEvent and InitDetailItems all runs javascript to prepare the detail region non-async (the user must wait for it to finish processing before they should get control of the browser).
    Then, the call to also add on a call to postLoad is where the cosmetic async stuff is supposed to happen. I am not a javascript expert by no means but from what I can gather:
    1. "window.addEventListener('load', postLoad, false);" works for most non-IE browsers, adds a call to postLoad on the event 'load', and "false" means that it is done non-binding (async).
    2. There is no "addEventListener" in MSIE, so it uses "window.attachEvent" to add the call to postLoad to the onload event. This is non-async with no async option, but....keep reading...
    PostLoad itself looks like this:
    function postLoad()
    { //Stuff do to after this region loads but can be done in an async fashion
      //because they're only cosmetic things.
      setAllMaintDescr(gMaintItemIdCol,gMaintItemIdCol + "_DISPLAY");
      checkAndColorFields();
    }setAllMaintDescr is the function that sets my popup key LOV values by querying the database and returning and setting the values in this field accordingly.
    checkAndColorFields is the function that passes some fields' values to a PL/SQL packaged function, it computes a color of black, red, yellow, or none and the javascript sets some field background colors accordingly. This logic resides in a PL/SQL package because we have a BI report that is a near copy of this page and needs to call the same logic.
    Both setAllMaintDescr and checkAndColorFields call htmldb_Get and get.GetAsync when the database work is done, so even though in MSIE the call to postLoad is not async, the functions themselves call async code that should theoretically be executing in an async manner.
    The Real Question(s)
    So...bottom line is that in Firefox, the page always takes about 20-25 seconds to load with or without setAllMaintDescr and checkAndColorFields commented/uncommented. This leads me to believe that my code in InitDetailItems (all non-async) is consistently taking 20-25 seconds to execute and postLoad processing is truly async since the page is returned to user control in the same amount of time.
    But in MSIE, without setAllMaintDescr and without checkAndColorFields, page load already is a slower 1 minute 35 seconds. With setAllMaintDescr and checkAndColorFields, it swells to well over 5 minutes whereas these async calls to htmldb_Get I would think should not increase much if at all over the initial 1:30 load time.
    Any tricks with MSIE? Any settings in the browser I need to know about? Is it truly ignoring my get.Get_Async calls and treating them as get.get()?
    Or is MSIE just truly that much of a turd as a browser? Ugh.
    Sorry for the long narrative but wanted to answer as many questions about my page first.

    ^^^ Long post.
    Cliff's notes for those I may have lost:
    Page dynamically adds two Javascript functions to the onload event.
    Each Javascript function calls some PL/SQL but it's all done using get.GetAsync.
    Firefox returns control of the page to the end user relatively quickly and consistently regardless of what functions are commented out/uncommented.
    MSIE is much slower and takes more time as I uncomment the async Javascript functions.
    Why does MSIE seem as if it's behaving non-asynchronously?

  • Asynchronous RFC call from R/3

    I need to make an asynchronous RFC call from R/3. I receive an error message in R/3 stating that my RFC destination can only be of type I (Internal) or type 3 (R/3 system). In order for it to reach XI I need it to be of type T (TCP/IP). Any help would be appreciated.
    Here is the function call.
    CALL FUNCTION 'Z_B2B_R3_FUNCTIONAL_ACK' starting new task 'SESSION1'
       destination 'RFC2XMBSERVICE'
          EXPORTING
               MSG_TYPE            = msg_type
               ORDER_HEADER_RETURN = order_header_return
          TABLES
               RETURNCODE          = i_return.
    the RFC desitnation RFC2XMBSERVICE is of type TCP/IP which by default makes it synchronous.
    Thanks,
    Jim

    hi,
    have you tried:
    CALL FUNCTION 'Z_B2B_R3_FUNCTIONAL_ACK'
    in background task
    destination 'RFC2XMBSERVICE'
    EXPORTING
    MSG_TYPE = msg_type
    ORDER_HEADER_RETURN = order_header_return
    TABLES
    RETURNCODE = i_return.
    commit work.
    Regards,
    michal

  • Problem with multiple Ajax calls to the same Servlet

    Hi,
    I am new to AJAX. I have a requirement where in, i have to make ajax calls to the same servlet in an infinite loop and check for an application context attribute to refresh the contents in the JSP.I am using the following script in JSP. The problem is i am not able to invoke the servlet more than one time.But I am able to go through the script at specific time interval using setInterval() function of Javascript and able to get alerts.But the problem is with xmlhttp.open("Get", url, true);. Its not getting called more than one time, even though i make multiple calls to the function.
    *<script type="text/javascript">*
    var xmlhttp
    var resp
    function fAjax()
    alert("Here");
    xmlhttp=null;
    resp=null;
    // code for Mozilla, etc.
    if (window.XMLHttpRequest)
    xmlhttp=new XMLHttpRequest();
    // code for IE
    else if (window.ActiveXObject)
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp!=null)
    xmlhttp.onreadystatechange=state_Change;
    xmlhttp.open("GET","/PSAPBackOffice/TestServlet",true);
    xmlhttp.send(null);
    else
    alert("Your browser does not support XMLHTTP.")
    function state_Change()
    // if xmlhttp shows "loaded"
    if (xmlhttp.readyState==4)
    // if "OK"
    if (xmlhttp.status==200)
         resp=xmlhttp.responseText;
         //alert(resp);
         if (resp=="CALL"){
         form.method="GET";
         form.action="/Project/Details.jsp          
    form.submit();
    else
    alert("Problem retrieving XML data")
    function callTimer(){
         setInterval("fAjax()",5000);
    *</script>*
    *Code for Servlet here:*
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
    ServletContext objContext= getServletContext();
         String value;
         synchronized (objContext) {
                   value=(String) objContext.getAttribute("Flag");
                        if(value==null){
                        else if(value.equals("Done")){
                             response.setContentType(CONTENT_TYPE);
                             PrintWriter out = null;
                                  try {
                                       out = response.getWriter();
                                  } catch (IOException e) {
                                       // TODO Auto-generated catch block
                                       e.printStackTrace();
                                                                } catch (NullPointerException npe) {
                                       // TODO Auto-generated catch block
                                       npe.printStackTrace();
                             objContext.setAttribute("Flag","No");
                             out.println("CALL");
    Can someone figureout the problem or mistake and help me out.Its urgent and please help me in this regard.Thanks in Advance !

    I'm not sure I'm following you. The mapping from URL to servlet can contain anything you want. So you could have the URL /blah/blah/blah that, with a mapping something like /blah/* would pass all requests with that URL pattern to your servlet - no one has to know it is a servlet. Your servlet could then parse the URL to see what it has to do or you could pass parameters as part of the URL or as hidden fields.

  • Re : what is diffrent Between  Synchronies and   Asynchronies  process

    Hi ,
          what is diffrent between Synchronies and   Asynchronies  process in  session Method and call Transcation method  pls give one Example...
    Thanks
    Arief .S

    Synchronus data processing is that in which the program calling the update task waits for the update work process to finish the update before it continues processing.
    In Asynchronus update the callng program does not wait for update work process to finish the update and continues as normal.
    A BDC done with sessions is always synchronus.
    A BDC with call transaction is by default asynchronus
    unless you define it explicitly as
    call transaction 'XXXX' ...... update 'S'.
    ( If you donot define update option it is defaulted to "A" ).
    The update method is of importance when one transaction locks data which may be required by a subsequent transaction . The subsequent transaction will fail if data is locked from previous one. An example would be you are creating sales order for same material in succession ( with asynchronus update ). Quite likely that some of transactions would fail due to material locked.
    For large volume of data Call Transaction will be faster but you have no restart capability here. Suppose from 1000 transactions 100 fails . You will have to run the BDC program again exclusing the ones which wrere successful. However with session method you have the option to process the error transactions again in SM35 . So if you are sure that errors will not occur use call transaction else use session method.

  • In bdc sessoin method which one is preferred synchronous or asynchronous..?

    hi could anybody tel me
    sessoin method which one is preferred synchronous or asynchronous..?
    what ll happen if we do other method..?
    foreground or background which one ll prefer..?
    what ll happen if we do otehr method..?
    thanx
    kals.

    Dear Kals,
    Synchronous or Asynchronous:
    If you need to process dependent transactions one after the other go for synchronous. Else, go for asynchronous.
    Asynchronous will have better performance.
    Ex:
    If you would like to process F.02. If it is successful process one more transaction using.
    Go for synchronous
    call transaction F.02 ........
    if successful.
       process one more dependent transaction.
    endif.
    If you just need to process F.02
    Go for Asynchronous.
    Background or Foreground:
    If there is a huge volume of data or no manual intevention is needed for background. If you would need manual intervention go for foreground.
    Performance would be better in Background.
    Visit the following thread:
    Re: sap general
    Hope this will help.
    Regards,
    Naveen.

  • Synchronous and Asynchronous BAPI

    Hi All,
    Like BDC do we have any options to update the database using BAPI synchronously or asynchronously? In BAPI which approach do we go for and is there a way that we can specify these update modes in BAPI like call transaction.
    Please help.
    Regards,
    MD.

    Hi
    Synchronous BAPIs
    Synchronous BAPIs are generally used to read data from a remote logical system, for example to display a customer list.
    Before calling the BAPI, it is therefore necessary to determine the RFC destination of the remote system or the BAPI server. The application developer has access to an API for determining the RFC destination of the BAPI.
    Asynchronous BAPIs
    Asynchronous BAPIs are generally used for replicating data on one or more logical systems, for example to distribute article master data.
    To implement an asynchronous data transfer with a BAPI, an ALE IDoc interface must be generated. This interface controls all of the data communication between logical systems using IDoc technology. The application then calls the generated ALE IDoc interface locally instead of the BAPIs.
    As with synchronous BAPIs, the corresponding logical systems of the BAPI must be determined before you call the ALE-IDoc interface. These are transferred to the ALE-IDoc interface as input parameters.
    http://help.sap.com/saphelp_nw04/helpdata/en/5a/ccb4cb808311d396b40004ac96334b/frameset.htm
    With Regards
    Nikunj Shah
    Edited by: Nikunj Shah on Jul 14, 2008 1:26 PM

  • Making an asynchronous method call in Oracle Weblogic Workshop 10.3.2

    Hi,
    Need to make a non blocking asynchronous method call from my application.
    There is an http url which i need to call but in asynchronous way.
    example:
    URL myPage = new URL("http://www.mypage.com/");
    URLConnection yc = myPage.openConnection();
    but the method to be invoked in non blocking or asynchronous way, so that the thread doesn't get stuck when the server of the target url ( http://www.mypage.com) is not working.
    regards
    pramod
    mumbai/India.

    Hi Pramod,
    Well in generally all the Synchronous call only if you want to achieve asynchronous method calls use Web-services method call.
    Here is link which help you to achieve your task.
    http://docs.oracle.com/cd/E11035_01/wls100/webserv_adv/asynch.html
    Regards,
    kal

Maybe you are looking for