adamlacombe Posted March 22, 2011 Share Posted March 22, 2011 I am trying to use this ajax: <!-- //Browser Support Code function ajaxStatus(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxform'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var status = document.getElementById('status').value; var mood = document.getElementById('mood').value; var queryString = "?status=" + status + "&mood=" + mood; ajaxRequest.open("GET", "ajax/status.php" + queryString, true); ajaxRequest.send(null); } //--> </script> the form echo '<form id="ajaxform"> <div class="content"> <b>Status:</b><input id="status" type="text" name="status" size="17" value="'.$status.'"> <b>Mood:</b><select name="mood"> <option value="'.$mood.'">'.$mood.'</option> <option value="Angry">Angry</option> <option value="Busy">Busy</option> <option value="bored">Bored</option> <option value="Calm">Calm</option> <option value="Cold">Cold</option> <option value="Confused">Confused</option> <option value="Content">Content</option> <option value="Curious">Curious</option> <option value="Crazy">Crazy</option> <option value="Depressed">Depressed</option> <option value="Drunk">Drunk</option> <option value="Emo">Emo</option> <option value="Embarrassed">Embarrassed</option> <option value="Energetic">Energetic</option> <option value="Envious">Envious</option> <option value="Exhausted">Exhausted</option> <option value="Flirty">Flirty</option> <option value="Full">Full</option> <option value="Grumpy">Grumpy</option> <option value="Happy">Happy</option> <option value="Hot">Hot</option> <option value="Hippie">Hippie</option> <option value="Hungry">Hungry</option> <option value="Hyper">Hyper</option> <option value="Indescribable">Indescribable</option> <option value="Lazy">Lazy</option> <option value="Loved">Loved</option> <option value="Mischievous">Mischievous</option> <option value="Okay">Okay</option> <option value="Nerdy">Nerdy</option> <option value="Pissed">Pissed</option> <option value="Relaxed">Relaxed</option> <option value="Relieved">Relieved</option> <option value="sad">Sad</option> <option value="Scared">Scared</option> <option value="Sick">Sick</option> <option value="Silly">Silly</option> <option value="Sleepy">Sleepy</option> <option value="Smart">Smart</option> <option value="Stressed">Stressed</option> <option value="Thoughtful">Thoughtful</option> <option value="Worried">Worried</option> <option value="Tired">Tired</option> <option value="Working">Working</option> </select> <p><input type="button" onClick="ajaxStatus()" value="update"></p> </div></form>'; Im not sure why it isn't working correctly.. it doesn't do anything when I click the button. Quote Link to comment Share on other sites More sharing options...
trq Posted March 22, 2011 Share Posted March 22, 2011 Have you read this? http://www.phpfreaks.com/forums/index.php?topic=323280.0 Quote Link to comment Share on other sites More sharing options...
adamlacombe Posted March 23, 2011 Author Share Posted March 23, 2011 Just read it.. I'm very new with ajax and jquery.. is there a snippet somewhere of what I am needing do you kno? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.