Hi Friends,

Please check this code where i was did wrong ? thanks in advance.

<button type="button" onclick='showData()'>Edit</button>
<script type="text/javascript">
			function showData()
			if (window.XMLHttpRequest)
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  xmlhttp=new XMLHttpRequest();
			  {// code for IE6, IE5
			  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			alert("Its Working");

The Alert code at the end of the code is displaying but the xmlhttp.open is not working.. please help

The alert() function does nothing to check whether your xmlhttp is working. Is your xmlhttp variable global? In other words, do you declare it somewhere and is being used somewhere else too? The reason is that I do not see you declare the object inside your function at all. In JavaScript, simply use a variable name in a function results in creating/assuming the variable is global - dangerous.

Let see if you actually get xmlhttp object created by inserting alert(xmlhttp) right before line 12.

commented: Reasoning +1

I had used so many xmlHttp finctions. when i was wrote alert(xmlHttp) its printing

[object XMLHttpRequest]


Please help me. Thanks in advance.

<div class='emp_body' id='fields'>

Got it. I didn't mention the id. i thought the class is the id. now its working fine.

Thanks All