GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Sunday, March 20, 2011

Ajax - Params In Post

To do sending parameter with post, what you need is do a little bit of code:

var ajax = new XMLHttpRequest();
ajax.open('POST', 'hello.php', false);
ajax.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
// below is data you send
ajax.send('name=luna&city=denpasar');

With ajax, you can also get info response from server:
var content_length = ajax.getResponseHeader('Content-length');

Share/Bookmark

No comments:

Post a Comment