Jump to content

Send info from a form to a php page


magicadmin

Recommended Posts

Hi all,I want to send some info from a form to a php page without reloading the page,I have tried some AJAX but its not 100% right, it works some of the time but some times its crashing out my server, it make my CPU run at 100% so i think there is a big bug in it.

var xmlHttpfunction clearwall(){var url="./includes/graffiti.php?painttext=&adminreset=1&userwallwiped=1"xmlHttp=GetXmlHttpObject(wallstateChanged)xmlHttp.open("POST", url , true)xmlHttp.send(null)} function wallstateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ wipegraffitiwall()} } function GetXmlHttpObject(handler){ var objXmlHttp=nullif (navigator.userAgent.indexOf("MSIE")>=0){ var strName="Msxml2.XMLHTTP"if (navigator.appVersion.indexOf("MSIE 5.5")>=0){strName="Microsoft.XMLHTTP"} try{ objXmlHttp=new ActiveXObject(strName)objXmlHttp.onreadystatechange=handler return objXmlHttp} catch(e){ alert("Error. Scripting for ActiveX might be disabled") return } } if (navigator.userAgent.indexOf("Mozilla")>=0){objXmlHttp=new XMLHttpRequest()objXmlHttp.onload=handlerobjXmlHttp.onerror=handler return objXmlHttp}}

Dose any one know how to do this or whats up with my ajax??Thanks all

Link to comment
Share on other sites

Since you aren't actually POSTing any code to your PHP page, you might try using GET instead. Try changing your code from:

xmlHttp.open("POST", url , true)xmlHttp.send(null)

to:

xmlHttp.open("GET", url , true);xmlHttp.send("");

Link to comment
Share on other sites

Since you aren't actually POSTing any code to your PHP page, you might try using GET instead. Try changing your code from:
xmlHttp.open("POST", url , true)xmlHttp.send(null)

to:

xmlHttp.open("GET", url , true);xmlHttp.send("");

Done that but i still have the same problem
Link to comment
Share on other sites

What is the code for your wipegraffitiwall() function?And what happens if you just visit ./includes/graffiti.php?painttext=&adminreset=1&userwallwiped=1?

Link to comment
Share on other sites

What is the code for your wipegraffitiwall() function?And what happens if you just visit ./includes/graffiti.php?painttext=&adminreset=1&userwallwiped=1?
The wipegraffitiwall() code is=
// Wipe wall refresh function.function wipegraffitiwall() {	rfsh = new Date(); rfsh = "?"+rfsh.getTime()	document.images["graffitiwall"].src = "<?php echo $graffiti_image; ?>?"+rfsh	toggleLayer('hiddenLayerLoad');}

It makes an image with the url in it lol...But it dose wipe the wall clean like its ment to.The problem is not all the time its only some times..Try itGraffiti Wall link

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...