Microsoft Ajax Library on PHP

A reader asked about the reference to running part of ASP.NET AJAX on PHP\Apache in my recent interview... The specific thing I was talking about was running the Microsoft Ajax Library on PHP...

Check out the CodePlex project.. Feel free to jump in and contribute to it.

https://codeplex.com/phpmsajax 

Here is the "hello, world" for this project..

 <?php
 
require_once '../../dist/MSAjaxService.php';
 
class HelloService extends MSAjaxService
{
    function SayHello($name)
    {
        return "Hello, " . $name . "!";
    }
}
 
$h = new HelloService();
$h->ProcessRequest();
 
?>

index.html:

 <html>
<head>
<title>Hello, World!</title>
<script type="text/javascript" src="../../MicrosoftAjaxLibrary/MicrosoftAjax.js"></script>
<script type="text/javascript" src="HelloService.php/js"></script>
</head>
<body>
Name: <input id="name" type="text" />
<input type="button" value="Say Hello" onclick="button_click(); return false;" />
<br />
Response from server: <span id="response"></span>
</body>
<script type="text/javascript">
    function button_click() {
        HelloService.SayHello($get('name').value, function (result) {
            $get('response').innerHTML = result;
        });
    }
</script>
</html>

Oh, and if you are interest in PHP, you might want to check out the FastCGI work on IIS to make PHP rock on IIS7.

Enjoy!