Hi
when i m trying to execute my ajax code using a link to display datas from another page named second.php.,
i got an error when the page loads in "ie"., which runs perfectly in firefox.,
here is my code -
-
<script type="text/javascript">
-
var i;
-
function httprequest(i)
-
{
-
-
var xmlhttp;
-
try
-
{
-
xmlhttp=new XMLHttpRequest();
-
}
-
catch(e)
-
{
-
try
-
{
-
xmlhttp=new Activexobject("Msxml2.XMLHTTP");
-
}
-
catch(e)
-
{
-
try
-
{
-
xmlhttp=new Activexobject("MICROSOFT.XMLHTTP")
-
}
-
catch(e)
-
{
-
alert("ur browser doesnot support Ajax");
-
return false;
-
}
-
}
-
-
}
-
xmlhttp.onreadystatechange=function()
-
{
-
if(xmlhttp.readyState==4)
-
{
-
-
obj = document.getElementById( "idname" );
-
-
obj.innerHTML = xmlhttp.responseText;
-
getBufferText();
-
-
}
-
}
-
-
xmlhttp.open("GET", "second.php?i="+i,true);
-
xmlhttp.send(null);
-
}
-
-
function call_sec(i)
-
{
-
httprequest(i)
-
}
-
</script>
-
-
<table id="idname">
-
-
.............
-
first page contents
-
.................
-
-
<a onclick="call_sec(<? echo $i;?>)">second</a></table>
-
when the page loads i get an error "Error: 'document.getElementById(...)' is null or not an object"
but works well with firefox.,
could anyone help me.,
its very urgent.,
thanks
8 5575 gits 5,390
Expert Mod 4TB
you have a typo - use:
in your IE section for creating the request-object.
kind regards
you have a typo - use:
in your IE section for creating the request-object.
kind regards
Hi
tried doing with the changes above., but still didnt get rid of the problem.,
thanks
gits 5,390
Expert Mod 4TB
please try to use a div instead of a table first ...
kind regards
please try to use a div instead of a table first ...
kind regards
Hi
tried changing to <div > tag., but not yet got the solution., when the page loads., i get the same error.,
thanks
gits 5,390
Expert Mod 4TB
when the page loads? the XMLHttpRequest should be triggered by the buttonclick ... isn't it? what code is executed onload of the page?
kind regards
when the page loads? the XMLHttpRequest should be triggered by the buttonclick ... isn't it? what code is executed onload of the page?
kind regards
Hi
No code is executed on onload of the page.,
The only script on my page is the javascript used for ajax.
I hav enabled script debugging in browser setting., and get tht error which displays in the aert 'document.getElementById('...'') is null or not an object.,
if i disable the script debugging
the page gets loaded well., and displays the result in the status bar as
"done, but with some errors on the page".,
here is my code again -
<script type="text/javascript">
-
var id;
-
var action;
-
-
-
function ajaxFunction(id,action)
-
{
-
-
var xmlHttp;
-
try
-
{
-
// Firefox, Opera 8.0+, Safari
-
xmlHttp=new XMLHttpRequest();
-
}
-
catch (e)
-
{
-
// Internet Explorer
-
try
-
{
-
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
-
}
-
catch (e)
-
{
-
try
-
{
-
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
catch (e)
-
{
-
alert("Your browser does not support AJAX!");
-
return false;
-
}
-
}
-
}
-
-
xmlHttp.onreadystatechange=function()
-
{
-
if(xmlHttp.readyState==4)
-
{
-
-
document.getElementById("ajax").innerHTML=xmlHttp.responseText;
-
}
-
}
-
-
xmlHttp.open("GET","ajax.php?id="+id+"&action="+action,true);
-
xmlHttp.send(null);
-
-
}
-
-
function hidden(id,action)
-
{
-
ajaxFunction(id,action)
-
}
-
-
</script>
-
kind regards
vijay
gits 5,390
Expert Mod 4TB
the only part i could see where the error could come from is here: - document.getElementById("ajax")
do you have a node with id = 'ajax' in your document? ...
kind regards
the only part i could see where the error could come from is here: - document.getElementById("ajax")
do you have a node with id = 'ajax' in your document? ...
kind regards
Hi got solution for the error,
i just simply added an if condition before tht line and got the solution.,
and thanks for tht.,
but after the page gets loaded.,
it displays the message in status bar as.,
"Done, but with some errors on page."
what might be the error???
how can i get an solution for this.,
regards
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Matt |
last post by:
I tried to display all html control types in the form. But it has run
time error
"object doesn't support this property or method" on
document.write(obj.type);
Even I do document.write('hello...
|
by: dubing |
last post by:
Hi,
Our webpage uses the following JavaScript code.
function toggleSubmenu(divId, link)
{
var div = document.getElementById(divId);
div.style.display = (div.style.display == 'block') ?...
|
by: Andrew Phillipo |
last post by:
I have some code that works everywhere but IE5.0, including IE5.5.
Here is a snippet of where the code seems to go wrong:
Location.prototype.change = function(current) {
this.current = current;...
|
by: westplastic |
last post by:
This one is driving me insane. The script works perfect on Firefox,
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java...
|
by: ABC |
last post by:
If there have a page which have unknown '<div>' label or may be no any
controls. I want add 'onclick' events to call server event to do something.
But there are no any events of 'Document' object...
|
by: sfeher |
last post by:
Hi All,
The following code returns a valid xmlDoc (since I can evaluate and
selectNodes) but its value is "xmlDoc= null" ?! Or at least
this is what the FireBug shows and (xmlDoc===null) is...
|
by: ipy2006 |
last post by:
In my HTML I have,
<input type="button" class="cartonsumkey" value="Sum Cartons"
onclick="sumup(this);" />
In an external file that is called in Head area, I have,
function sumup( o ) {
...
|
by: juliejam |
last post by:
Hello all, I am new here and hope some kind, smarter than me person can help.
I am getting the error object expected with the following code:
function click(e);
here the error says it...
|
by: pratimapaudel |
last post by:
function Showdiv()
{
var SelectStates = document.getElementById('Select1').value;
if(SelectStates ="3")
{
document.getElementById("div2").style.display = "block";
}
else
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
| |