The fastest easiest way to get it right.

process

NAME

x6.json.process

FUNCTION

The Javascript method x6.json.execute is the final step in sending and receiving JSON requests. This routine does the following:


  • Any HTML sent back via PHP x4HTML replaces the innerHTML of the named items (actually item Ids are used).
  • Any script sent back via PHP x4Script is executed.
  • Any data sent back via PHP x4Data is placed into x6.data.

EXAMPLE

This example shows how you can retrieve table data and then process it:

      <script>
      x6.json.init('x4Page','myCustomPage');
      x6.json.addParm('x4Action','getStates');
      // x6.json.execute will return false on errors
      if(x6.json.execute()) {
         // x6.json.process puts everything in its place...
         x6.json.process();
         // ...so that we can handle the returned data
         for (var idx in x6.data.states) {
            // do something
         }
      }
      <script>

This code requires the following PHP code on the server:

      <?php
      # this is file application/x4myCustomPage.php
      class x4myCustomPage extends androX4 {
          function getStates() {
              $states = SQL("Select * from states");
              x4Data('states',$states);
          }
      }

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2