ANT%20Interview%20Questions%20and%20Answers
Question: How to Generate/Send JSON Data at the Client Side?Answer: • Create JSON JavaScript object• Use "POST" HTTP method in the open method of the XMLHttpRequest object • Pass JSON JavaScript object in the send method of XMLHttpRequest object var carAsJSON = JSON.stringify(car); var url = "JSONExample?timeStamp=" + new Date().getTime(); createXMLHttpRequest(); xmlHttp.open("POST", url, true); xmlHttp.onreadystatechange = handleStateChange; xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlHttp.send(carAsJSON); |
Is it helpful?
Yes
No
Most helpful rated by users:
- Who is the Father of JSON ?
- What is the file extension of JSON?
- What is JSON?
- Why use JSON over XML?
- Explain JSON with php.