Foros del Web » Programando para Internet » Javascript » Frameworks JS »

problemas con el xajax

Estas en el tema de problemas con el xajax en el foro de Frameworks JS en Foros del Web. hola saludos a todos soy muy nuevo en esto de usar ajax pero lo que quiero es hacer una validacion ahora bien baje el xajax ...
  #1 (permalink)  
Antiguo 25/04/2011, 09:52
 
Fecha de Ingreso: abril-2011
Mensajes: 4
Antigüedad: 13 años
Puntos: 0
problemas con el xajax

hola saludos a todos soy muy nuevo en esto de usar ajax pero lo que quiero es hacer una validacion ahora bien baje el xajax por un tutorial del foro trato de probar un ejemplo y me da errroes del archivo de php ni idea que estoy haciendo mal
este es el codigo (no es el de validacion solo para probar un ejemplo en xajax)
Código:
<?php
/*
	File: helloworld.php

	Test / example page demonstrating the basic xajax implementation.
	
	Title: Hello world sample page.
	
	Please see <copyright.inc.php> for a detailed description, copyright
	and license information.
*/

/*
	@package xajax
	@version $Id: helloworld.php 362 2007-05-29 15:32:24Z calltoconstruct $
	@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
	@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/

/*
	Section: Standard xajax startup
	
	- include <xajax.inc.php>
	- instantiate main <xajax> object
*/
require ('xajax/xajax_core/xajax.inc.php');
$xajax = new xajax();

/*
	- enable deubgging if desired
	- set the javascript uri (location of xajax js files)
*/
//$xajax->configure('debug', true);
$xajax->configure('javascript URI', '../');

/*
	Function: helloWorld
	
	Modify the innerHTML of div1.
*/
function helloWorld($isCaps)
{
	if ($isCaps)
		$text = 'HELLO WORLD!';
	else
		$text = 'Hello World!';
		
	$objResponse = new xajaxResponse();
	$objResponse->assign('div1', 'innerHTML', $text);
	
	return $objResponse;
}

/*
	Function: setColor
	
	Modify the style.color of div1
*/
function setColor($sColor)
{
	$objResponse = new xajaxResponse();
	$objResponse->assign('div1', 'style.color', $sColor);
	
	return $objResponse;
}

/*
	Section:  Register functions
	
	- <helloWorld>
	- <setColor>
*/
$reqHelloWorldMixed =& $xajax->registerFunction('helloWorld');
$reqHelloWorldMixed->setParameter(0, XAJAX_JS_VALUE, 0);

$reqHelloWorldAllCaps =& $xajax->registerFunction('helloWorld');
$reqHelloWorldAllCaps->setParameter(0, XAJAX_JS_VALUE, 1);

$reqSetColor =& $xajax->registerFunction('setColor');
$reqSetColor->setParameter(0, XAJAX_INPUT_VALUE, 'colorselect');

/*
	Section: processRequest
	
	This will detect an incoming xajax request, process it and exit.  If this is
	not a xajax request, then it is a request to load the initial contents of the page
	(HTML).
	
	Everything prior to this statement will be executed upon each request (whether it
	is for the initial page load or a xajax request.  Everything after this statement
	will be executed only when the page is first loaded.
*/
$xajax->processRequest();

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>xajax example</title>
<?php
	// output the xajax javascript. This must be called between the head tags
	$xajax->printJavascript();
?>
	<script type='text/javascript'>
		/* <![CDATA[ */
		window.onload = function() {
			// call the helloWorld function to populate the div on load
			<?php $reqHelloWorldMixed->printScript(); ?>;
			// call the setColor function on load
			<?php $reqSetColor->printScript(); ?>;
		}
		/* ]]> */
	</script>
</head>
<body style="text-align:center;">
	<div id="div1">*</div>
	<br/>
	
	<button onclick='<?php $reqHelloWorldMixed->printScript(); ?>' >Click Me</button>
	<button onclick='<?php $reqHelloWorldAllCaps->printScript(); ?>' >CLICK ME</button>
	<select id="colorselect" name="colorselect"
		onchange='<?php $reqSetColor->printScript(); ?>;'>
		<option value="black" selected="selected">Black</option>
		<option value="red">Red</option>
		<option value="green">Green</option>
		<option value="blue">Blue</option>
	</select>
</body>
</html>
y este es el error que me da

Parse error: syntax error, unexpected '<', expecting T_FUNCTION in E:\xampp\htdocs\pagina jr gusmai\xajax\xajax_core\xajax.inc.php on line 316

gracias por la ayuda .............................. la verdad estoy muy perdido en esto de usar el xajax
  #2 (permalink)  
Antiguo 25/04/2011, 10:58
 
Fecha de Ingreso: enero-2011
Ubicación: DF
Mensajes: 898
Antigüedad: 13 años, 2 meses
Puntos: 155
Respuesta: problemas con el xajax

tienes la liga de donde sacaste el ejercicio?
__________________
No me interesan ni las gracias ni los karmas , pero si que se genere conocimiento, si se dio con la respuesta por favor confirmalo

Etiquetas: php, xajax
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:47.