JavaScript functions not completed when Ajax callbacks are involved

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    JavaScript functions not completed when Ajax callbacks are involved

    I have a Validator that uses callbacks in the javascript client-side
    evaluation. the client-side JavaScript function specified in the
    WebForm_DoCallb ack function does not complete until the Validator function
    (the one specified using the evaluationfunct ion attribute) has completed.
    Because of this, I cannot use the results of the callback in the result of
    the evaluationfunct ion. Any ideas? Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。



  • Blackhand

    #2
    Re: JavaScript functions not completed when Ajax callbacks are involved

    WebForm_DoCallb ack is defined as such:

    WebForm_DoCallb ack('__Page',Co mmand,CallBackH andler,context, onError)

    The parameter you want to pay attention to is "CallBackHandle r".

    CallBackHandler is a function to be executed only when the ajax request
    to the server has received a response and has been fully completed.

    The context parameter is also important, as it defines the context the
    CallBackHandler function is to be executed in.

    Example

    WebForm_DoCallb ack('__Page',Co mmand, function() {
    //Code you want executed when the ajax request to the server has
    completed successfully.
    }, this); //Set the context of the callback handler to the current context

    Its important to remember, the flow of javascript is a little different
    to your traditional language. If a request is started, the flow of the
    code WILL NOT STOP and wait for the request to complete, it will carry
    on running, this is why callback handlers are often implemented as
    additional function parameters.

    Nathan Sokalski wrote:
    I have a Validator that uses callbacks in the javascript client-side
    evaluation. the client-side JavaScript function specified in the
    WebForm_DoCallb ack function does not complete until the Validator function
    (the one specified using the evaluationfunct ion attribute) has completed.
    Because of this, I cannot use the results of the callback in the result of
    the evaluationfunct ion. Any ideas? Thanks.

    Comment

    • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

      #3
      RE: JavaScript functions not completed when Ajax callbacks are involve

      you can not use an async call from a validator. as the validator return value
      controls whether the postback is done. you could make sync webservice call,
      or cancel the postback, then in javascript start the postback again in the
      async callback.


      -- bruce (sqlwork.com)


      "Nathan Sokalski" wrote:
      I have a Validator that uses callbacks in the javascript client-side
      evaluation. the client-side JavaScript function specified in the
      WebForm_DoCallb ack function does not complete until the Validator function
      (the one specified using the evaluationfunct ion attribute) has completed.
      Because of this, I cannot use the results of the callback in the result of
      the evaluationfunct ion. Any ideas? Thanks.
      --
      Nathan Sokalski
      njsokalski@hotm ail.com
      有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

      >
      >
      >

      Comment

      Working...