Logo

Maarten Balliauw {blog}

ASP.NET, ASP.NET MVC, Windows Azure, PHP, ...

About the author

Maarten Balliauw is currently employed as .NET Technical Consultant at RealDolmen. His interests are mainly web applications developed in ASP.NET (C#) or PHP and the Windows Azure cloud platform.
More about me More about me
Send mail E-mail me


ASP.NET MVC Quickly Subscribe to my RSS feed Follow me on Twitter! View Maarten Balliauw's profile on LinkedIn
View Maarten Balliauw's MVP profile

Search

Latest Twitter

    Follow me on Twitter...

    Archive

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

    © Copyright Maarten Balliauw 2012


    Have you alreday tried PRAjax?

    Some people who know me, have already experimented with my home-brew PHP Ajax framework, PRAjax. PRAjax is short for PHP Reflected Ajax, and provides the glue between server-side PHP and client-side Javascript. You should really try it out in your project!

    My blog uses PRAjax too. Try navigating to the homepage and clicking a [more...] link. The article body is then fetched behind the scenes and updated on your browser view.

    A small example...

    One can write a method in PHP, and make it callable by the client using JavaScript. For example, you have the following PHP code:

    function Hello($pName = '') {
    return 'Hello, ' . $pName;
    }

    On the client-side, you can now call this method asynchronously (using, for example, a link with an onclick method "Hello('Maarten');", and get the result in a callback function:

    function Hello_cb (pData) {
    if (pData != null) {
    alert(pData);
    }
    }

    That's all there is to it! It's even possible to pass objects between PHP and JavaScript.

    Currently, I'm considering porting this to ASP.NET but I do not expect much interest because of Atlas, which offers much more options combined with a complete ASP.NET-alike object model.


    Categories: General | Projects | Software

    Pingbacks and trackbacks (2)+

    Comments are closed