Hi guys,
Once again i have come to halt in my coding with a problem. I am making a php/ajax website. After generating the initial html and javascript code with php, i have a link which communicates with another php script using xmlhttprequest.
This works great. I am using post by the way, not get. Once i call the php script, i want it to be able to have access to the session variables. So, i run, session_start at the very top. Php has a problem with this saying i have already sent headers (i am assuming this is in reference to the headers that must be sent in order for post to work?). Is there a way around this or should i change to get? I would like to use post as it is more secure and also there is no limit to the character length im able to pass.
Heres the function calling the php script using post.
Any help or pointing out of flaws in my logic would be greatly appreciated!!!Code:function toggle_week(element_id) { clear_slate(); document.getElementById("statusbar").innerHTML = "Loading..."; var myscript = "toggle_week.php"; var params = "direction="+element_id; http.open("POST", myscript, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function(){ if(http.readyState == 4 && http.status == 200) { document.getElementById("statusbar").innerHTML = "done"; //Remove this later var info = (http.responseText).split("|"); change_dates(info[0]); } } http.send(params); }








Bookmarks