Compartilhar via


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!

Comments

  • Anonymous
    March 04, 2007
    If it works in PHP, then it works excellent for me in my Wordpress project.

  • Anonymous
    March 04, 2007
    The comment has been removed

  • Anonymous
    March 05, 2007
    Why not just use Phalanger and run any .NET code [ ajax included] in Php and vice versa?  They've put the php lib into a .NET language. Refer : http://tinyurl.com/24xo46

  • Anonymous
    March 05, 2007
    As you may know, we have already announced that the IIS team was working with Zend to improve PHP performance

  • Anonymous
    March 05, 2007
    beberapa hari lalu, IIS meng-announce kerja sama dengan Zend Team untuk meningkatkan performa PHP di

  • Anonymous
    March 09, 2007
    摘要本期共有10篇文章:在ASP以及非ASP.NETURL中使用ASP.NET安全验证在PHP中使用MicrosoftAjaxLibraryOrcas版本C#语言的新特性:自动属性、对...

  • Anonymous
    May 09, 2007
    " 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. " Thanks! I've just started to study PHP and I think that the more articles I'll read, the better it'll be for my styding. Am I right?

  • Anonymous
    May 10, 2007
    >I think that the more articles I'll read, the better it'll be for my styding. Am I right? Yes. You're absolutly right! I'm studying php for half year, and I should say that I have confronted with difficulties, because I had wery few articles.

  • Anonymous
    November 15, 2007
    要 本期共有10篇文章: 在ASP以及非ASP.NETURL中使用ASP.NET安全验证 在PHP中使用MicrosoftAjaxLibrary Orcas版本C#语言的新特...