Xbasic

a5AjaxChunkedResponseWrite Function

Syntax

C a5AjaxChunkedResponseWrite(c javascript [,p e])

Arguments

javascriptCharacter

JavaScript to send back to the client.

ePointer

The e object that was passed to the Ajax Callback. e must be passed into a5AjaxChunkedResponses() if the javascript message includes placeholders (e.g. {dialog.object} or {dialog.componentName}).

Returns

resultCharacter

a5AjaxChunkedResponseWrite returns an empty string.

Description

Used in an Ajax callback that sends back chunked responses. Sends a message to the client.

Discussion

The a5AjaxChunkedResponseWrite() function can be used to send messages from the server to the client while an Ajax Callback is being processed. The message is JavaScript to execute on the client.

dim js as c
js = "$('div').innerHTML = 'Still working...';"
a5AjaxChunkedResponseWrite(js)

The message can include JavaScript placeholders. If it does, you must also pass the e object, which is passed to the Ajax Callback, into the a5AjaxChunkedResponseWrite(). For example:

function xbCallback1 as c (e as p)
    dim js as c
    js = "{dialog.object}.setValue('PLACEHOLDER_1','Still working...');"
    a5AjaxChunkedResponseWrite(js, e)

    '...rest of callback

    return "{dialog.object}.setValue('PLACEHOLDER_1','Complete!');"

end function

This function is used with the Ajax Callback Action Javascript with "Chunked Responses" enabled.

See Also