laravel/laravel — pull request #780 by joecwallace (2012-06-08 01:22:26+00:00)
Title: 'AJAXful' routing

I have made this change in just about every project I've built using Laravel, so I thought I would share it. If it's bad or wrong or not useful, that's fine, but I thought I would put it out there.

This "AJAXful" routing works pretty much like the RESTful routing; it prepends "ajax_" to your controller actions when the request is an AJAX one.

Here's a RESTful and AJAXful controller example:

```php

'Hooray, AJAX'));
}
}

```

Likewise, for non-RESTful controllers:

```php

'Hooray, AJAX'));
}
}

```

Pretty straightforward, but it's been helpful for me.