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.

Recommended Answers

All 7 Replies

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.

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

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>

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

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.