473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

responseText and IE issue

4
Hi, I'm working with the responseText on IE but I have a problem with it

I make this

var test = xmlhttpobject.responseText;

alert(test);

there is no problem with those two lines, the problem is that I'm sending from the server the word "si" and what I get in variable is a 5 characters word.

Then whe I'm trying to verify the word that I'm recieving with this

Expand|Select|Wrap|Line Numbers
  1.                      for( var i=0 ;  i<test.length ; i++)
  2.         {
  3.         if (  test[i] == 's' )
  4.              if ( test[i+1] == 'i' )
  5.             test="si";
  6.                     }
  7.  
  8.  
and then I do

if ( test == "si")
document.location.href = "url";

doesn't work and always get into the else statement of the if that didn't put it here.

When I'm verifiying the what the test variable containt with alert(test[i]) always say Undefined for all the characters even if the string has the letters "s" and "i"

The funny thing is that this work on Mozilla Firefox like with almost all the other things

Can someone help me with it?
Feb 10 '08 #1
4 1492
acoder
16,027 Expert Mod 8TB
You're resetting test within the for loop. Use charAt to get the character within the string.
Feb 11 '08 #2
Jay10k
4
Ohh sorry I forget one line into the if statement

for(var i=0; i<test.length ; i ++)

if(test[i] == 's')
if(test[i+1] == 'i')
{
test = "si"
break;
}

I do actually reset test cause as I said before the string length is of 5 elements and if I compare test == "si" it doesn't match ... even when I'm getting the string back from the server ...


And thank you anyway for your help I will try as you say ...
Feb 11 '08 #3
Jay10k
4
Yes you got it, the problem was resolved thank you very much for your help :)
Feb 11 '08 #4
acoder
16,027 Expert Mod 8TB
You're welcome. Post again if you have more questions.
Feb 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla,...
3
by: e271828 | last post by:
I'm trying to access the source of an HTML page with as few alterations from the actual source (as in, that seen from the View Source option) as I can. The method...
6
by: mihirnmehta | last post by:
This is my code function getDetails() { var name = document.getElementById("movie_name").value; if (window.XMLHttpRequest) //For Mozilla Browsers { XMLHttp=new XMLHttpRequest() }
1
by: KAS | last post by:
First of all, I am very much a newbie... From what I have read, it seems to me that both of these should be filled in all the time. The responseXML being a DOM representation and the responseText...
4
by: -Lost | last post by:
For example: var newlines = 'a\n\nb\n\nc'; alert(newlines); Yet, if I get that *exact* same line from an XMLHttpRequest's responseText, it is always alerted as: a\n\nb\n\nc
3
by: JMcCrillis | last post by:
I've implemented a FileUpload servlet using AJAX and JS. It appears to be working well but for one issue. I used XMLHTTP so I could intercept the response in Javascript and write it out to a field...
1
by: farghal | last post by:
Hello as many people I'm new to ajax but trying my best to understand. At this point I got a problem I'm not able to solve. I've looked on several forums and googled internet but I can't find a...
6
by: lazukars | last post by:
Hi, I am attempting an ajax request. I am using PHP serverside. Below is what the response text should be. ajaxRequest.responseText ="{username_is_taken : "This username has been taken",}" ...
5
by: wendallsan | last post by:
Hi all, I'm running into a situation where it seems that JS stops executing as soon as I call an eval in my script. I have an Ajax.Request call to a PHP page that builds a JS object and returns...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.