PHP for Microsoft AJAX Library

20. February 2010

Author: Aamir Hasan

PHP updated  support for Microsoft AJAX Library. It works with the RTM bits, and fixes several of the issues reported in my earlier samples. , so that you can join in and contribute to the project.The Microsoft AJAX Library is a standalone collection of the standards-based JavaScript classes included in Microsoft ASP.NET AJAX. it simply supports exposing PHP classes as AJAX-enabled web services, just as in ASP.NET applications. In fact, the generated proxies are identical to what you get from ASP.NET


Test  Example

<?php

require_once '../../dist/MSAjaxService.php';

class TestService extends MSAjaxService
{
function SayHello($name)
{
return 'Welcome, ' . $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() {
TestService.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. 

Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

Ajax, Javascript, PHP , , ,


Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading





User Name: Guest

Your Ip: 38.107.191.91
Time: