View Full Version : Getting two different local variables from an Ajax request?

02-03-2009, 09:48 PM
I'm using this javascript with Ajax technique to check if the value of an input textfield already exists in the database. the javascript is taking the server variable and putting it into one lcoal variable. I would like two different variables depending on what is returned so i could design the message differently.

Here is the code within the javascript doing the job:

ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
document.getElementById('nameresult').innerHTML = ajaxRequest.responseText;

I would like it so that if the ajaxRequest.responseText value is 1 and if it has a value of 0 I get two different local variables to use. Hope that makes sense.