Javascript examples for Language Basics:XMLHttpRequest
Send Json data via XMLHttpRequest
<html> <head> <title>Web Page Design</title> <script> function sayHello() {/* ww w. j a v a 2s . c om*/ var xhr = new XMLHttpRequest(); var url = "http://localhost:5043"; xhr.open("POST", url, true); xhr.setRequestHeader("Content-type", "application/json"); var data = JSON.stringify({"test" : "hello"}); xhr.send(data); } sayHello(); </script> </head> <body> </body> </html>