I'm new in PHP MVC, I have a question about how javascript works with php mvc
If I have a page with a button, when user click the button It will send to next page and update data in database
$(document).ready(function(){
$("#btn").click(function(){
$.load(){... }
or $.post(){.....}//post data to another page
});
});
//next page
if(isset($_POST[])){
//update data
}
My question is
Should I send this data to controller than pass to model and output in view(if we need respond something)
Button --javascript--> controller -> model(update data) --send data back--> view
or
I can just send data to page and update without mvc
ob_start()you can buffer your output and then useob_get_contents()to get full output in a variable so you can echo it . in the javascript you can take it and put in in document using .innerHTML of your output container