Tags shown in xmlhttp.responseText

How come when I populate my textbox with what's in xmlhttp.responseText tags are shown? It shows

<!DOCTYPE html><html><body></body></html> 

as well as what I want it to show. Is there a way to make it so that the tags aren't shown? The Javascript and AJAX code is as follows:

function loadDoc()
   var xmlhttp;

   // code for IE7+, Firefox, Chrome, Opera, Safari
   if (window.XMLHttpRequest)
      xmlhttp=new XMLHttpRequest();
   // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

      if (xmlhttp.readyState==4 && xmlhttp.status==200)


ADDED-Code for loadTextBox.php is as follows:

---placeholder for correct db login info---

$result = $mysql->query(---placeholder for correct SQL query---);

while ($row = $result->fetch_object())
   $queryResult = $row->column_1;
$textboxValue = $queryResult;
echo $textboxValue; 


Well, I was unable to reproduce your problem, so I had to improvise slightly to get the same responseText as you. Anyway, this is what I came up with, please let me know if it doesn't work:

var doc = window.document.createElement("doc");
doc.innerHTML = xmlhttp.responseText;

Replace your current instance of:


With that.

Need Your Help

Java synchronization in web service

java multithreading web-services concurrency synchronization

I have a java restful webservice program thats hosted on tomcat. In one of my web service methods, I load a big arraylist of objects (about 25,000 entries) from redis. This arraylist is updated once

How to handle loops when going i-1

c# list loops polygon triangulation

I have a general question about looping in c#, especially when using lists.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.