0

Hai friends,
Please help me that how can i solve this problem,
how can i include AJAX in PHP,Can u tell me that how can i configure system for AJAX.

4
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by phper
0

You need to learn more about Ajax as you don't include ajax into PHP. In fact PHP really doesn't even care or know about Ajax. All you need to know with your PHP code is whether or not to send out XML headers or not. That's it.

0

Thank U Friend for Ur reply...........
Can U give more explanation about it.........

0

Hai friend,
Can U tell me that how can i solve this error,
its giving error i.e printing whole xajax_core.jsfile,

<?php
require('xajax_core/xajax.inc.php');
require('xajax_js/xajax_core.js');
$xajax=new xajax();
$xajax ->registerFunction("helloWorld");


function helloWorld($isCaps)
{
if ($isCaps)
$text = "<b>BAYLOGIC TECHNOLOGIES...VENU !</b>";
else
$text = "<b>baylogic technologies...venu!</b>";


$objResponse = new xajaxResponse();
$objResponse->assign("div1","innerHTML",$text);


return $objResponse;
}
function setColor($sColor)
{
$objResponse = new xajaxResponse();
$objResponse->assign("div1","style.color", $sColor);


return $objResponse;
}
$xajax->registerFunction("helloWorld");
$xajax->registerFunction("setColor");
$xajax->processRequest();


echo '<?xml version="1.0" encoding="UTF-8"?>';
?>


<html>
<head>
<title>xajax example</title>
<?php
// output the xajax javascript. This must be called between the head tags
$xajax->printJavascript();
?>
<script type='text/javascript'>


window.onload = function() {
// call the helloWorld function to populate the div on load
xajax_helloWorld(0);
// call the setColor function on load
xajax_setColor(document.getElementById('colorselect').value);
}


</script>
</head>
<body style="text-align:center;">
<div id="div1" name="div1">&#160;</div>
<br/>


<button onclick="xajax_helloWorld(0)" >Click Me</button>
<button onclick="xajax_helloWorld(1)" >CLICK ME</button>
<select id="colorselect" name="colorselect"
onchange="xajax_setColor(document.getElementById('colorselect').value);">
<option value="black" selected="selected">Black</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="yellow">Yellow</option>
<option value="cyan">Cyan</option>
</select>
</body>
</html>

Edited by happygeek: fixed formatting

0

Iam getting this error,,,,
Error:The xajax JavaScript component could not be included, Perhaps the URL is incorrect?
URL:xajax/xajax_core.js

0

Iam getting this error,,,,
Error:The xajax JavaScript component could not be included, Perhaps the URL is incorrect?
URL:xajax/xajax_core.js

0

There's no need for you to include the .JS file like that. Use

<script type="javascript" src="xajax_js/xajax_core.js"></script>

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.