Revision: 39773
Updated Code
at January 20, 2011 20:48 by danhanly
Updated Code
function sendProject(){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('files').style.display = "inline"; document.getElementById('project').style.display = "none"; pid = xmlhttp.responseText; } } var title=encodeURIComponent(document.getElementById("p_title").value); var description=encodeURIComponent(document.getElementById("p_description").value); var featured=encodeURIComponent(document.getElementById("p_featured").value); var parameters= "title="+title+"&description="+description+"&featured="+featured; xmlhttp.open("POST", "../scr/addProject.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(parameters); }
Revision: 39772
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 20, 2011 20:48 by danhanly
Initial Code
function sendProject(){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('files').style.display = "inline"; document.getElementById('project').style.display = "none"; pid = xmlhttp.responseText; } } var title=encodeURIComponent(document.getElementById("p_title").value); var contents, vals = [], p_contents = document.forms['addForm']['p_contents[]']; for(var i=0,elm;elm = p_contents[i];i++) { if(elm.checked) { vals.push(encodeURIComponent(elm.value)); } } contents = vals.join(', '); var description=encodeURIComponent(document.getElementById("p_description").value); var featured=encodeURIComponent(document.getElementById("p_featured").value); var parameters= "title="+title+"&contents="+contents+"&description="+description+"&featured="+featured; xmlhttp.open("POST", "../scr/addProject.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(parameters); }
Initial URL
Initial Description
Initial Title
AJAX MySQL Query
Initial Tags
mysql, ajax, php, data
Initial Language
JavaScript