-1

Let's say that hypothetically you wanted to build a website that delivered content to the visitors entirely using HTML and Javascript (AJAX to fetch server side data). The site would require login for certain functions. Let's also say, for the sake of discussion, you have the ability to create necessary web service methods that would be called from AJAX (for authenticating a user, getting data from a database, etc).

What would be the best way to implement this site? Would there be any advantages / drawbacks compared to building a site using a server side language like ASP.NET or PHP?

EDIT 1

First, thanks to everyone that has replied so far. I didn't properly phrase my question so I'm getting responses that aren't addressing my question. I've built many sites using traditional methods - a database backend and a frontend that was a mix of server side languages (.NET or PHP) and client side scripting JavaScript / jQuery.

Let's say I'm going to build an environment that has a database server, a web services server, and a web server. My web services server has all the methods I need to interact with the database (authentication, CRUD operations, reporting, etc). The web server does not support any server side languages (like PHP or ASP.NET).

I know it would be possible to build the site entirely in HTML, CSS, and JavaScript (jQuery). A user could be authenticated via AJAX, the authentication token could be stored in a cookie, and then token could be used on all subsequent AJAX requests.

My questions are:

  1. What would be the advantages / drawbacks of such an approach?
  2. What challenges would be faced with authentication and security?
  3. Would this solve any of the problems typically faced when building a website?
  4. If your boss was asking you to use this environment, would you argue against it? Why or why not?

closed as too broad by Jim G., Wayne Molina, user40980, Dan Pichelman, user53019 Jul 25 '14 at 14:08

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    This is essentially what comes built in with asp.net mvc 5. The basic template will literally solve this entire problem for you. asp.net/mvc – Travis J Jul 23 '14 at 23:09
1

You cannot use HTML and AJAX on its own to access your databases or data stored on remote/hosting server. You will need a server side scripting language PHP, ASP, PERL, CGI, etc.

HTML and AJAX run on the "client side", the computer accessing the web page. The server side languages run on the "server". HTML can invoike AJAX to access a server side script which in turn will return a value and said value can be parsed and pushed back to web page.

PHP is the most popular and simplest of them all so it may be a good start. I use PHP and have found that combined with JQuery, there is simply nothing I cannot do.

3

Login using AJAX, jQuery and PHP: https://stackoverflow.com/questions/14449118/php-ajax-login

Personally I think PHP is barbaric. The only acceptable use is if you're using a framework like CakePHP or Laravel. My preference is Django Python or Node.js. But there is no disadvantage to which backend you use. Each language has its strengths and can perform whatever you need to.

The main advantage of having a framework is that they can usually handle authentication for you. You shouldn't handle authentication yourself because chances are that you will have security vunerabilities in the way you do it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.