Welcome Guest, Not a member yet? Register   Sign In
Space problem in Java script
#1

[eluser]Shiju S S[/eluser]
I have a javascript district.js
Code:
var xmlHttp55;

//////////////////////////
function districtcheck(id){
document.getElementById("cityspace")[removed]="<img src='images/loading.gif' width='10' height='10' > Loading.......";  
xmlHttp55=GetXmlHttpObject()
if (xmlHttp55==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
  
var url="/quickbharath/addfields/district"
url=url+"/"+id;    

xmlHttp55.onreadystatechange=stateChangedEff1;
xmlHttp55.open("GET",url,true);
xmlHttp55.send(null);
}
function stateChangedEff1()
{
if (xmlHttp55.readyState==4)
document.getElementById("cityspace")[removed]=xmlHttp55.responseText;
}
///////////////////
function GetXmlHttpObject()
{
var xmlHttp55=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp55=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp55=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp55=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp55;
}
It passes id to the controller "/quickbharath/addfields/district"

When I echo id
The value 'Tamil Nadu' is seen as 'Tamil%2Nadu'

How can I solve the space problem. Please help me.
#2

[eluser]CroNiX[/eluser]
A space is not a valid URL character, so it was urlencoded(). Now you need to decode it.




Theme © iAndrew 2016 - Forum software by © MyBB