473,385 Members | 1,655 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,385 software developers and data experts.

can't call the servlet using AJAX

sk
I create some javascript to send some search request.
However, on some machines i wont' be able to send
request. What could be the reason?

function sendSearchRequest()
{
var srch_url = "/servlet/Search";
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
}
}
}

request.open('GET', srch_url , true );
request.onreadystatechange = GetSearchResponse;
request.send(null);
}

function GetSearchResponse()
{}
Jul 18 '06 #1
1 1730
sk said the following on 7/18/2006 6:34 PM:
I create some javascript to send some search request.
However, on some machines i wont' be able to send
request. What could be the reason?
Several.

The browser doesn't support the HTTPRequest Object.
The browser doesn't allow ActiveX.
You are using limited HTTPRequest code.
function sendSearchRequest()
{
var srch_url = "/servlet/Search";
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
If the browser doesn't support Msml2.XMLHTTP or Microsoft.XMLHTTP then
your code fails silently. There are MSIE's with other versions of
XMLHTTP support and no non-IE browser supports your code.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peter | last post by:
My client wants to develop a web application using Java. I have several questions and seeking for MVP advise. 1. Does IIS support Sun Micro Java? 2. Is it possible for .NET to mix with Java,...
2
by: Michael | last post by:
Hello, Has anyone figured out how to call a Servlet from a C# Web Service? Thanks in advance, Michael...
17
by: petermichaux | last post by:
Hi, Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server. Thanks, Peter
4
by: Frances | last post by:
I literally started learning AJAX just last weekend.. I have this page, http://www.francesdelrio.com/ajax/db2.html, where I'm essentially doing what's here,...
1
by: Farce Milverk | last post by:
Hi, Is it possible to have a Servlet on Server A call a Servlet on Server B (both running single instances of an identical webapplication) without using a Proxy setup? For example, if a request...
4
by: spargos | last post by:
I'm having significant trouble getting the scriptalicious or dojo toolkits to work for me. For instance I'm trying to implement a simple blinddown in my page. If I were to do this: <div...
6
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am...
5
by: makthar | last post by:
Hi I have a JSP that calls an Ajax function when a button is clicked. The Ajax function calls a servlet . The Ajax function works well in Mozilla , but in IE7 when the button is clicked it works...
3
by: rbansalit | last post by:
Hi all I am making a very simple ajax call. But I am not getting any message from sever. <html> <body> <script type="text/javascript"> function ajaxFunction()
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.