POST method in AJAX
Link |
by Atsuku(binku)
on 2009-02-23 06:02:56 (edited 2009-02-23 06:05:35)
|
xmlHttp2 = GetXmlHttpObject(); if (xmlHttp2 == null) { alert ("Browser ndak suprot aktif http rekues"); return; } var bodyofrequest = getReqarg(); var url = "xml_vald.php"; /*url = url+"&sid="+Math.random();*/ -> is it needed to in post method? try {xmlHttp2.open("POST",url,true);} catch (e) {alert (e.description);} xmlHttp2.onreadystatechange = stateChangedUser; try {xmlHttp2.send(bodyofrequest);} catch (e) {alert (e.description);} Is there anything wrong from it? I had tried it but when i try to retrieve the xml document(xml_vald.php) it's look like this file doesn't create the xml response that i expected(error : undefined). |
Re: POST method in AJAX
Link |
by
on 2009-02-23 08:03:28
|
what is the value of "getReqarg()" your "bodyofrequest" must not start with a "?" and should follow the same GET format. I'm not sure but I don't use the random id my self on post method. |
Re: POST method in AJAX
Link |
by Atsuku(binku)
on 2009-02-24 07:38:32
|
It's yeah content the request name and value. I just trying to send username and password to serverside using Javascript, so it's for security reason i try to use post method. But i have no idea why it seem my serverside script doesn't receive anything. |
Re: POST method in AJAX
Link |
by
on 2009-02-24 08:43:02
|
I also forgot. "xmlHttp2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");" place this after "xmlHttp2.open". |
Re: POST method in AJAX
Link |
by Atsuku(binku)
on 2009-03-16 02:35:25 (edited 2009-03-16 02:36:09)
|
I has decide to use GET method. I haven't try it yet. Maybe after few period i'll try it. Tq for helping me and feel so sorry for replying in a long time. >.< |
Re: POST method in AJAX
|
maybe you can restart from here: http://www.w3schools.com/ajax/ajax_intro.asp
http://czetsuya-travel.blogspot.com
|