Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Function Reference

xajax ( function , response_node , submit_form [true] , post_data , default_action [false] )

Description
No description.
 
Parameters
requiredfunction
optionalresponse_node
optionalsubmit_form [true]
optionalpost_data
optionaldefault_action [false]
 
Code
127  function xajax($function, $response_node=null, $submit_form=true, $post_data=null, $default_action=false)
128  {
129      global $sess;
130 
131      if ($default_action==="none")
132      {
133          $default_action = "";
134      }
135      else
136      {
137          $default_action = $default_action ? "return true;" : "return false;";
138      }
139 
140      $js  = "var f = (this) ? ((this.form) ? this.form : parentForm(this)) : null;";
141      $js .= "var fd = (f) ? showFormData(f.id) : ''; ";
142      $js .= "var event = (event || null);";
143      $js .= "
144          var thisval = '';
145          if (this)
146          {
147              if (this.type=='checkbox')
148              {
149                  if (this.checked)
150                  {
151                      thisval = this.name + '=' + this.value;
152                  }
153              }
154              else
155              {
156                  thisval = this.name + '=' + this.value;
157              }
158          }
159      ";
160      $js .= "makeRequest(event,(this || null),'POST','" . $_SERVER["SCRIPT_URL"] . "?ajax',";
161      $js .= "'f=$function&response_tag=$response_node&' + thisval + '";
162      $js .= $submit_form ? "' + fd + '" : null;
163      $js .= (is_null($post_data)) ? null : "&" . $post_data;
164      $js .= "&$sess->name=$sess->hash";
165      $js .= "',false);";
166      $js .= $default_action;
167 
168      return $js;
169  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads