jsp - split value not getting in javascript -


i have 2 jsp.one user.jsp.in jsp getting record database , append space between 2 records.for ex: ab9898329379 ab989832937937.the code user.jsp follows.

string  data ="";    resultset  rs = st.executequery(query);            while(rs.next())                 {                  data += rs.getstring("user_registeration_code")+" " ;                system.out.println("-------a------"+data);                 } 

secondjsp sys.jsp.in have used ajax , getting result of above jsp in response.the code of sys.jsp follows.

function showemp(emp_value) {       var fname = document.getelementbyid("txtfirstname").value;     alert(fname);     var lname = document.getelementbyid("txtlastname").value;     alert(lname);         if(document.getelementbyid("txtmobileno").value!="")         {             alert("1");  xmlhttp=getxmlhttpobject(); if (xmlhttp==null)  {alert("2");  alert ("browser not support http request");  return;  } var url="getuser.jsp"; url=url+"?emp_id="+emp_value+"&firstname="+fname+"&lastname="+lname;  xmlhttp.onreadystatechange=statechanged;  xmlhttp.open("get",url,true); xmlhttp.send(null);          }         else         {                  alert("please select employee id");         } }  function statechanged()  {           document.getelementbyid("txtfirstname").value ="";         document.getelementbyid("txtmobileno").value =""; if (xmlhttp.readystate==4 || xmlhttp.readystate=="complete")  {          var showdata = xmlhttp.responsetext;    var strar = showdata.split(" ");    alert(strar[0]);   }  }  function getxmlhttpobject() { var xmlhttp=null; try  {  // firefox, opera 8.0+, safari  xmlhttp=new xmlhttprequest();  } catch (e)  {  //internet explorer  try   {   xmlhttp=new activexobject("msxml2.xmlhttp");   }  catch (e)   {   xmlhttp=new activexobject("microsoft.xmlhttp");   }  } return xmlhttp; } 

i not getting expected result strar[0]=ab9898329379,strar[1]=ab989832937937. please help. in advance rushang

use loop values

for (var = 0; < strar .length; i++) {    alert(strar[i]); } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -