Question

We use Sajax for adding small Ajax code to sites. After running into a problem and doing some digging, it seems the library hasn't been updated since 2005.

I've appreciated Sajax for being lightweight, easy to use, and easy to install (just include the file in PHP).

So, on the LAMP stack, if you have used Sajax before, what would you upgrade to? Ease of use is key since some semi-programmer web developers use the code too.

I know a lot of people would say jQuery, but is that as simple as Sajax?

Was it helpful?

Solution

I would say it is easier to use jQuery.ajax:

$.ajax({
    type: 'GET',
    url: './example.json',
    dataType: 'json'
}).done(function (data) {
    // Use data...
});

$.getJSON('./some.php', { q: 'thing' }).done(function (data) {
    // Use data...
});

$.ajax({
    type: 'POST',
    url: './api.php',
    data: {
        action: 'save',
        info: APP.getInfo(),
        token: APP.getToken()
    }
});

jQuery is a great tool with lots of examples and plugins that allow you to do some pretty amazing things!

OTHER TIPS

Sounds a lot like xajax

Correct me if I'm wrong but Sajax is a PHP library and jQuery is a javascript library. Just felt like that distinction needs to be made.

At our company we use jQuery and I think it's absolutely fantastic. Wouldn't trade it for anything else. But I would advise you to try any of the other many javascript libraries (Prototype, MooTools, YUI) and find out which one works for you.

Or you could use S2ajax: http://github.com/Fusion/s2ajax/tree/master

I just finally got around to pushing it to Github :)

If you're looking for jQuery integration with PHP, there are some classes in the Zend Framework. See: http://framework.zend.com/manual/en/zendx.jquery.html

There is also my branch over at http://sajax.info/ it mainly just fixes the outstanding issues with 0.12 and focuses on speeding sajax up even more.

I recommend jQuery. It's much more straight forward that Sajax, which tries to be both end points for you. Besides, it can get messy with output buffering sometimes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top