So I am a student working on a website for a private client. In my web design class we have been taught to mostly use forms to pass values from the client to the server with action=someFile.php
. The class has also briefly mentioned using ajax to pass from the client using javascript and jquery using something like:
request = $.ajax({
url: "persistTestimonial.php",
type: "POST",
data: {"testimonial": testimonial},
dataType: "json"
});
I also had an internship with a company where I was writing c# services passing back and forth between client and server with canjs for mvc. In the context of mvc and c# backend writing ajax calls using the way above makes sense. Since the class harps on graceful degradation I don't entirely see the benefit of javascript ajax instead of php forms other than that the entire page doesn't have to reload. I just want to know what is best practice and what exactly the benefits are.