<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src=""></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>OSM L1 operations</title>

<script>


   function  emailValidate()
    {


      email = document.getElementById("HLR_STATUS_MSISDN").value;


        $.ajax({
        url : "GetOSMStatus1?txtname="+email,
        success : function (data) {
             alert(data.toString());
                  }
        });


    }

</script>

</head>
<body>


    <div id="container" style="width:100%;height:100%;background-color:#FF0000;">

    <div style="position:absolute;top:10; border:1px solid red; left:30%; width:500px; height:175;background-color:#ADD8E6;">


    <div id="header" style="background-color:#FFD700;">
    <h3 style="margin-bottom:0; text-align:center;">OSM L1 Operations</h3></div>

    <table height='10' width='200'>
      <tr>
        <td>
          <img src="images/viva_logo.jpg" height="30%" width="100%">
        </td>
      </tr>
    </table>


    <form name="HLR_MSISDN_Status" method="POST" onsubmit="return false;" ><FONT FACE="arial" SIZE="2">
        Get HLR Status for a MSISDN </FONT> 
        <TABLE BORDER="0" bgcolor=#D3D3D3 >

       <TR>
            <TD><FONT FACE="arial" SIZE="1"> MSISDN:&nbsp; </FONT>  </TD>
             <TD>    
                 <input type="text" name="HLR_STATUS_MSISDN" id="HLR_STATUS_MSISDN" maxlength="11" SIZE="30">  
            </TD> 
       </TR>
        </TABLE> 
    <input type="button" name="Submit" value="Submit" onClick="emailValidate();"/>
    <div id="message"></div>
    </form> 
    <br />


    <div id="footer" style="background-color:#FFD700;clear:both;text-align:center;">
    www.techmahindra.com</div>   

    </div>
    </div>


</body>
</html>

Dani AI

Generated

Diagnosis for : Firefox is returning a parsed XML DOM object to the jQuery success callback, so calling toString() shows something like "object XMLDocument". Other browsers may coerce or display the response differently, which is why the same alert looks correct elsewhere. jQuery chooses how to deliver the response based on the HTTP Content-Type header (or an explicitly set dataType).

Practical fixes (pick one depending on the desired result):

Force the raw response string

$.ajax({
  url: 'GetOSMStatus1',
  data: { txtname: document.getElementById('HLR_STATUS_MSISDN').value },
  dataType: 'text',
  success: function(rawText) { alert(rawText); }
});

Get the raw response from the jqXHR object

success: function(data, status, jqXHR) {
  alert(jqXHR.responseText);
}

Work with parsed XML properly

success: function(xml) {
  var xmlString = new XMLSerializer().serializeToString(xml);
  alert(xmlString);
  // or extract a value:
  var val = $(xml).find('SomeTag').text();
}

Debug checklist and tips: inspect the request/response in Firefox Developer Tools (Network tab) to confirm the Content-Type and the actual response body; prefer dataType: 'json' and return JSON if parsing is intended (simpler cross-browser); avoid relying on alert(obj.toString()) for objects — use console.log / console.dir or the raw responseText. Also ensure the server sets an explicit Content-Type header that matches the data being returned.

Even i firefox i can see that the server side code ir servlet is getting called but the output in firefox is only as follows
object xmldocument

while in other browsers its correct as expected.
Helpppppppp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.