jjacquay712 Posted December 10, 2008 Share Posted December 10, 2008 ok... here is my problem, i am submitting POST data to a php script, but for some reason its not getting all the data, all it returns is this: " code '. Here is the POST data: name=john&code=function getXML() { var xmlObject; try { // Firefox, Opera 8.0+, Safari xmlObject=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlObject=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlObject=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlObject; } var xmlHttp = getXML(); function ajaxdelete(id) { if (confirm("Are You Sure You Want To Delete This?")){ xmlHttp.onreadystatechange=function(){ document.getElementById('i' + id).innerHTML = ""; } xmlHttp.open("GET","index.php?deleteid=" + id,true); xmlHttp.send(null); } } function ajaxadd(name, code) { xmlHttp.onreadystatechange=function(){ if( xmlHttp.readyState == 4 ) { document.getElementById('codearea').innerHTML = xmlHttp.responseText; } } var locate = "name=" + name + "&code=" + code + '&button=Submit'; xmlHttp.open("post",'code.php',true); xmlHttp.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); xmlHttp.send(locate); } &button=Submit (its random javascript for the data) And here is the data type: Content-Type: application/x-www-form-urlencoded; charset=UTF-8 here is the URL http://johnj.gknu.com/codedump/ of the script im thinking php isnt getting all the data because of the form data type. Any Ideas ? Link to comment https://forums.phpfreaks.com/topic/136354-solved-formatting-post-data/ Share on other sites More sharing options...
jjacquay712 Posted December 10, 2008 Author Share Posted December 10, 2008 I FIGURED IT OUT! i had to encode the POST data using escape() for the special charicters. Link to comment https://forums.phpfreaks.com/topic/136354-solved-formatting-post-data/#findComment-711367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.