I am designing a website which will query a simple MySQL database using AJAX calls to PHP scripts.
I have looked into frameworks which achieve this but I'm l开发者_运维知识库ooking for a lighter weight solution and so am rolling my own. At present I have all AJAX calls hitting a single script, which then calls further functions based on the content of POSTed variables. Those functions return objects or throw exceptions, and in my main script I either return a JSON encoded version of the object or catch the exceptions and return a JSON encoded "error object".
Does this approach sound ok or not? If not, what is best practice in this scenario?
on the serverside i would reommend a restful approach.
and for the client side javascript i would recommend jQuery ($().ajax())
and it probably would't hurt to code after the principles of MVC
精彩评论