Browser-Server Communication Flashcards
1
Q
How can you pass data to the server?
A
- Using “?param=value” chain after the server .address.
2. Using FormData interface.
2
Q
How can you convert any JavaScript object into a JSON string?
A
Use .stringify() method of JSON JavaScript object. Example:
var myArr = [1,2,"Hello"]; var jsonString = JSON.stringify(myArr);
JSON is a built-in JavaScript object that has only 2 methods for parsing and converting values to/from JSON format.
3
Q
How can you parse a string into a JSON object?
A
Use .parse() method of JSON JavaScript object.
JSON is a built-in JavaScript object that has only 2 methods for parsing and converting values to/from JSON format.