FAQ - Mod 5

From CSE330 Wiki
Jump to: navigation, search

Welcome to the frequently asked questions page for Module 5. As many common questions can come up on Piazza, some of those questions are consolidated here.

File Structure/Languages

Can I redirect users to another page after login/for any other reason?

For this module, you can not redirect a user to another page for login or refresh the page on logout. You should have one single html file , and any on-screen changes should be done through DOM manipulation in Javascript.

Can/should I use PHP in this module?

PHP should be used to access the MySQL database for this module, but you should use Javascript for most other functionality. The focus of this module is for you to learn more about Javascript and the DOM, so do not use PHP to redirect to other pages or refresh the current one.

CSRF Tokens

How do I pass CSRF tokens between PHP and Javascript?

At the end of your PHP script execution, you can send values back to where you initially called the script from. Think about how you can use this to then store the token in Javascript.

HTML Validator

I'm getting a validation warning about missing an src attribute for my weather widget, what should I do about this?

Before you fetch the data in the weather widget, you may not have a src attribute for your img tags. Your warning will likely look like this:

Element img is missing required attribute src

An easy way to avoid this warning is to simply put a temporary image on the screen before you load in the weather data.