![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
function buildPOST(formName, formTask) { theForm = document.getElementById(formName); var qs = '' for (e=0;e<theForm.elements.length;e++) { if (theForm.elements[e].name!='' && theForm.elements[e].type ! = 'button' && theForm.elements[e].type != 'submit') { var name = theForm.elements[e].name; qs+=(qs=='')?'':'&' qs+= name+'='+escape(theForm.elements[e].value); } } if (formTask != null) { qs+="&task="+formTask; } qs+="\n"; return qs } and this how i send it... var postString = buildPOST(...); ... xmlHttp.send(postString); |
#3
| |||
| |||
|
|
function buildPOST(formName, formTask) { [...] qs+="\n"; return qs } and this how i send it... var postString = buildPOST(...); ... xmlHttp.send(postString); i have noticed that when i us $_POST['task'] with PHP (the last var in the line) its actually that data + whitespace, so i need to do trim($_POST['task']), question is why this happens? i don't think it's the buildPOST func, since i tried tirming befor sending with ajax. |
![]() |
| Thread Tools | |
| Display Modes | |
| |