I was reading up on AJAX requests in Drupal 7 at http://codekarate.com/blog/drupal-7-javascript-ajax-framework-example-link
Where the AJAX framework is explained in detail, when used on custom links and potentially other HTML elements.
Now it got me wondering,
In a more "custom" point of view, I have created some (regular) hook_menu() implementations in the past, (without any /ajax or /nojs stuff) that would just return json data.
So, basically I implemented links in my custom module that would get called via a custom jQuery file (via $.post or $.get), via a click() event or something like this, that in turn fired the hook_menu() mentioned above.
This would then return some json data after processing the request, this returned data would get fetched by my jQuery script, and the DOM would be updated with the data that was returned by the ajax call (json, ...).
Now I am just wondering on the pro's and con's of both ways of doing things.
It figures that the first one is more "the Drupal way", and the second one is much more custom...
Since I never had any issue with using the second way of things, I am very curious to hear what you all have to say on this matter.
Thanks in advance.
Best
Guardian