23
Oct
Livelink-JSON output for AJAX request handler
Posted by Hussain, under LivelinkThis execute() method of request handler is use to generate JSON which can be use for AJAX. This is simple request handler which give name as out put, while here header type is text, if it is change to xml and then xml data can be outputed.
| Text | | copy code | | ? |
| 01 | // This is the method use to out put JSON data which can be use for AJAX implementation. |
| 02 | function Dynamic Execute( Dynamic ctxIn, Dynamic ctxOut, Record r ) |
| 03 | //Variable to store JSON info |
| 04 | String outString = '' |
| 05 | outString += '[{"name":"ABC"}]' //JSON |
| 06 | Dynamic headerString = "Pragma: no-cache" + Web.CRLF + "Cache-Control: no-cache" + Web.CRLF + "Content-Type: text/plain" + ( Web.CRLF + Web.CRLF ) |
| 07 | boolean testvalue3 = Web.Write( ctxOut, headerString ) |
| 08 | boolean testvalue4 = Web.Write( ctxOut, outString ) |
| 09 | if ( Type( ctxOut ) == Socket.SocketType ) |
| 10 | Socket.Close( ctxOut ) |
| 11 | end |
| 12 | .fHTMLFile = undefined |
| 13 | .fLocation = undefined |
| 14 | return Undefined |
| 15 | end |



Post a Comment