Comments on: Simple Ajax Functions – Snippets /index.php/2006/03/08/simple-ajax-functions-snippets/ Helping newbies learn AJAX with Tutorials Sat, 08 Jan 2011 17:21:04 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: kj /index.php/2006/03/08/simple-ajax-functions-snippets/#comment-107 kj Sun, 24 Sep 2006 02:05:48 +0000 /?p=4#comment-107 hey the tutorial is great! this was the 1st time iv even tried doing anything like this and it was so easy to follow along.... iv managed to create a form and it works perfect in I.E.......but y wont it work in Firefox???? this is my code....any help will be much appreciated...thnkz... Untitled Document var myObjectReference = createRequestObject(); function createRequestObject() { var xmlObject; try{xmlObject=new ActiveXObject("Msxml2.XMLHTTP");} catch (e){ try { xmlObject=new ActiveXObject("Microsoft.XMLHTTP");} catch(f) { xmlhttp=null; } } if(!xmlObject&&typeof XMLHttpRequest!="undefined") { xmlObject=new XMLHttpRequest(); } return xmlObject; } function sendRequestTextPost() { var rnd = Math.random(); var myvalue1 = escape(document.getElementById("myvalue1").value); var myvalue2 = escape(document.getElementById("myvalue2").value); try{ myObjectReference.open('POST','serverscript.php'); myObjectReference.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myObjectReference.onReadyStateChange = handleResponseText; myObjectReference.send('myvalue1='+myvalue1+'&myvalue2='+myvalue2+'&rnd='+rnd); } catch(e){} finally{} } function handleResponseText(){ try{ if((myObjectReference.readyState == 4) && (myObjectReference.status == 200)){ var response = myObjectReference.responseText; document.getElementById("idforresults").innerHTML = String(response); } } catch(e){alert("there was an error");} finally{} } MY VALUE 1: MY VALUE 2: ------------------ serverscript.php : hey the tutorial is great! this was the 1st time iv even tried doing anything like this and it was so easy to follow along….

iv managed to create a form and it works perfect in I.E…….but y wont it work in Firefox????

this is my code….any help will be much appreciated…thnkz…

Untitled Document

var myObjectReference = createRequestObject();

function createRequestObject() {

var xmlObject;

try{xmlObject=new ActiveXObject(“Msxml2.XMLHTTP”);}
catch (e){
try { xmlObject=new ActiveXObject(“Microsoft.XMLHTTP”);}
catch(f) { xmlhttp=null; }
}

if(!xmlObject&&typeof XMLHttpRequest!=”undefined”) {
xmlObject=new XMLHttpRequest();
}

return xmlObject;
}

function sendRequestTextPost() {
var rnd = Math.random();
var myvalue1 = escape(document.getElementById(“myvalue1″).value);
var myvalue2 = escape(document.getElementById(“myvalue2″).value);
try{
myObjectReference.open(‘POST’,'serverscript.php’);
myObjectReference.setRequestHeader(‘Content-Type’,'application/x-www-form-urlencoded’);
myObjectReference.onReadyStateChange = handleResponseText;
myObjectReference.send(‘myvalue1=’+myvalue1+’&myvalue2=’+myvalue2+’&rnd=’+rnd);
}
catch(e){}
finally{}
}

function handleResponseText(){
try{
if((myObjectReference.readyState == 4) && (myObjectReference.status == 200)){
var response = myObjectReference.responseText;
document.getElementById(“idforresults”).innerHTML = String(response);
}
}
catch(e){alert(“there was an error”);}
finally{}
}

MY VALUE 1:
MY VALUE 2:

——————

serverscript.php :

]]>
By: Shwetamogadpally /index.php/2006/03/08/simple-ajax-functions-snippets/#comment-92 Shwetamogadpally Thu, 17 Aug 2006 12:29:59 +0000 /?p=4#comment-92 Yes really it is very nice for newbies!!! Can u plz explore more on How it works? How to use AJAX in an Application? Yes really it is very nice for newbies!!!
Can u plz explore more on How it works? How to use AJAX in an Application?

]]>
By: Shwetamogadpally /index.php/2006/03/08/simple-ajax-functions-snippets/#comment-91 Shwetamogadpally Thu, 17 Aug 2006 12:26:25 +0000 /?p=4#comment-91 Very nice article!!! And really usefull to newbeis. But can u please more explore on What is AJAX? How is it working? How to use AJAX in an Application? :) Very nice article!!! And really usefull to newbeis.
But can u please more explore on What is AJAX? How is it working?
How to use AJAX in an Application? :)

]]>
By: joey /index.php/2006/03/08/simple-ajax-functions-snippets/#comment-13 joey Tue, 11 Apr 2006 23:05:55 +0000 /?p=4#comment-13 Very nice tutorial!Very helpful!Thank you man! Very nice tutorial!Very helpful!Thank you man!

]]>