/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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); }