Sunday, 15 May 2011

Compare read string with string in javascript -


I am reading a string file and wanting my JS file according to the string value. Code here:

  var text; Var xhr = (window.xmlHttpRequest)? New XMLHttpRequest (): New Active X Object ("Microsoft.XMLHTTP"); Exercise Open ('GET', RU Scholar + "Jobstats", False); Xhr.send (); Text = xhr.responseText; If (text! = "OK") {window.alert ("Something went wrong. Read error:" + text); Ui.hideDialog ('Carunning'); Return;}  

The text is correct, even if the text is read "OK" is there any type of formatting problem?

Thanks

Remove white space around it to compare it with "OK" Before .trim () text

  text = xhr.responseText.trim ();  

No comments:

Post a Comment