Ajax Post Request


/ Published in: JavaScript
Save to your folder(s)

Simple Ajax POST request using the getHTTPObject function.


Copy this code and paste it in your HTML
  1. var request = getHTTPObject();
  2. if(request){
  3. request.onreadystatechange = doSomething;
  4. request.open("POST", "file.ext", true);
  5. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  6. request.send("name=whatever+goes+here&message=hello+world");
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.