JS/PHP: Who is responsible for generating the content?

Posted by Extrakun on Stack Overflow See other posts from Stack Overflow or by Extrakun
Published on 2010-08-25T06:55:15Z Indexed on 2010/12/24 13:54 UTC
Read the original article Hit count: 139

Filed under:
|

Here's a situation which I have encountered, creating a form on the client side and using PHP to process. Here are some considerations

  1. The PHP script generates the form and send to the client side. This is because of internationalization issues
  2. The client side uses JavaScript to submit form; the ID of the form is hard-coded inside the JavaScript as it is generated by PHP. This means everytime the PHP code is updated, the JS must change.

The question here is, who should be dependent on who? Should the JS generate the form instead, so that the PHP script has to know the names of the form elements? OR should it be the other way round?

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript