Using the Microsoft AJAX Library with PHP

Steve Marx has been working behind the scenes on building out a community project to create native PHP support for the Microsoft AJAX Library.  Today he released the first version.  He provides a ton of details in this post which I steal liberally from below.

First download ASP.NET AJAX or grab just the client side Microsoft AJAX Library

Second, check out the codeplex project

Third, code away -- you can contribute bugs, code and more at the CodePlex site -- I think this is pretty darn cool and when you think about this in terms of our FastCGI work on IIS things are getting very cool for developers in any language/platform.

Check out this HelloWorld sample code:


require_once '../../dist/MSAjaxService.php';
class HelloService extends MSAjaxService
    function SayHello($name)
        return "Hello, " . $name . "!";
$h = new HelloService();


<title>Hello, World!</title>
<script type="text/javascript" src="../../MicrosoftAjaxLibrary/MicrosoftAjax.js"></script>
<script type="text/javascript" src="HelloService.php/js"></script>
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>
<script type="text/javascript">
    function button_click() {
        HelloService.SayHello($get('name').value, function (result) {
            $get('response').innerHTML = result;

Definitely let us know what you think!

Comments (5)
  1. AJAX : The Official Microsoft ASP.NET AJAX Site ScottGu’s Blog ASP.NET AJAX 1.0 Released RC 버젼 공개 한달하고

  2. At the risk of sounding cynical, this appears to be just marketing spin.  Why else would someone use a framework that was intended for ASP.NET (heck – it has it in its name) for PHP when there are so many other established AJAX frameworks out there? (e.g. prototype).

    But I guess it all helps in the end.

    Now if I could only find an add-in for Visual Web Developer Express to do proper syntax highlighting of PHP code…

  3. Dflying Chen says:


  4. TheXenocide says:

    I would say that it would probably be to promote consistency within more complicated Enterprise Systems. Besides that, this actually looks like the Web Service side of the AJAX call, not necessarily the client interaction piece. I haven’t looked things over thoroughly, but at first guess i would say the above code returns results used by an AJAX call that is likely to initiate from an ASP.NET Site/Application. Even if it is a full fledged AJAX framework for PHP, wouldn’t it be nice to become familiar with a single system and be able to use it with any programming language?


  5. Sentido Web says:

    ASP.NET AJAX, la librería Ajax de Microsoft, está disponible para los usuarios de PHP (si es que hay algún valiente que se atreva). La gente de Microsoft ha resarrollado un proyecto en Codeplex que sirve de puente entre PHP y…

Comments are closed.

Skip to main content