AJAX-Concept of CakePHP 2 and 3

Hello all,

I’m learning CakePHP 2.x for some time and don’t had much experience with AJAX in the past.
But now I would like to use it and I hope that somebody can explain me the basic concept of how AJAX and CakePHP works.
In my tests I used the jQuery .load() function to open a regular view via GET and place the responce to the prefixed DIV.
$("#target_id").load(url, function() {});
Then I placed a save-button outside the #target_id and used .ajax() function to POST the serialized form data within #target_id.
Even if this is working so far, it has some drawbacks, e.g.
…clicking arbitrary links inside #target_id (pagination links for example) results in opening the involved view instead loading it via AJAX
…flash messages are not working at all
Not least because the jsHelper is deprecated I wonder how to handle AJAX without placing buttons outside the view?
I think I fundamentally misunderstood the whole AJAX thing and hope that you can tell me something about its underlying concept.
Many thanks in advance
tkh

Please search right here I and others recently covered some ajax

here are some links that i’ve found useful:

happy researching, McS

hi @jimgwhit you can try it here