469,277 Members | 2,405 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,277 developers. It's quick & easy.

Error: Unknown runtime error in ie while using ajax

134 100+
hi
when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

here is my javascript code.,

[HTML]<script type="text/javascript">
var id;
var action;
function httprequest(id,action)
{

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)
{
document.getElementById("ajax").innerHTML=xmlhttp. responseText;
}
}

xmlhttp.open("GET","url/"ajax.php?id="+id+"&action="+action,true);
xmlhttp.send(null);
}

function hidden(id,action)
{
httprequest(id,action)
}
</script>

<table id="ajax">------Place where i fetch data from another page and display---------
<tr><td><a onclick="hidden('1','next')">next</a></td></tr>
</table>
[/HTML]

Could anyone help me.,
Thanks.,
vijay
Mar 19 '08 #1
20 8828
vjayis
134 100+
hi
when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

here is my javascript code.,

[HTML]<script type="text/javascript">
var id;
var action;
function httprequest(id,action)
{

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)
{
document.getElementById("ajax").innerHTML=xmlhttp. responseText;
}
}

xmlhttp.open("GET","url/"ajax.php?id="+id+"&action="+action,true);
xmlhttp.send(null);
}

function hidden(id,action)
{
httprequest(id,action)
}
</script>


<table id="ajax">------Place where i fetch data from another page and display---------
<tr><td><a onclick="hidden('1','next')">next</a></td></tr>
</table>


[/HTML]
Could anyone help me.,
Thanks.,
vijay
Mar 19 '08 #2
vjayis
134 100+
hi
when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

here is my javascript code.,
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var id;
  3. var action;
  4. function httprequest(id,action)
  5. {
  6.  
  7. var xmlhttp;
  8. try
  9. {
  10. xmlhttp=new XMLHttpRequest();
  11. }
  12. catch(e)
  13. {
  14. try
  15. {
  16. xmlhttp=new Activexobject("Msxml2.XMLHTTP");
  17. }
  18. catch(e)
  19. {
  20. try
  21. {
  22. xmlhttp=new Activexobject("MICROSOFT.XMLHTTP")
  23. }
  24. catch(e)
  25. {
  26. alert("ur browser doesnot support Ajax");
  27. return false;
  28. }
  29. }
  30.  
  31. }
  32. xmlhttp.onreadystatechange=function()
  33. {
  34. if(xmlhttp.readyState==4)
  35. {
  36. document.getElementById("ajax").innerHTML=xmlhttp.responseText;
  37. }
  38. }
  39.  
  40. xmlhttp.open("GET","url/"ajax.php?id="+id+"&action="+action,true);
  41. xmlhttp.send(null);
  42. }
  43.  
  44. function hidden(id,action)
  45. {
  46. httprequest(id,action)
  47. }
  48. </script>
  49.  
  50.  
  51. <table id="ajax">------Place where i fetch data from another page and display---------
  52. <tr><td><a onclick="hidden('1','next')">next</a></td></tr>
  53. </table>
Could anyone help me.,
Thanks.,
vijay
Mar 19 '08 #3
rpnew
188 100+
hi
when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me.,

here is my javascript code.,

<script type="text/javascript">
var id;
var action;
function httprequest(id,action)
{

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)
{
document.getElementById("ajax").innerHTML=xmlhttp. responseText;
}
}

xmlhttp.open("GET","url/"ajax.php?id="+id+"&action="+action,true);
xmlhttp.send(null);
}

function hidden(id,action)
{
httprequest(id,action)
}
</script>


<table id="ajax">------Place where i fetch data from another page and display---------
<tr><td><a onclick="hidden('1','next')">next</a></td></tr>
</table>



Could anyone help me.,
Thanks.,
vijay
Hi,

What is the error that you are getting??

Regards,
RP
Mar 19 '08 #4
ronverdonk
4,258 Expert 4TB
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

This is not a PHP question, but a JavaScript one.

This thread will be moved to the JS forum.

moderator
Mar 19 '08 #5
hsriat
1,654 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. xmlhttp.open("GET", "ajax.php?id=" + id + "&action=" + action, true);
Mar 19 '08 #6
acoder
16,027 Expert Mod 8TB
Threads merged. Please do not double post your questions.

Moderator.
Mar 19 '08 #7
vjayis
134 100+
Hi,

What is the error that you are getting??

Regards,
RP
hi Rp.,

when i click on the ajax link("Next") i get an error displaying tht:
Error: Unknown runtime error;

thts it.,

thanks.,
vijay
Mar 20 '08 #8
acoder
16,027 Expert Mod 8TB
You have an extra double quote in the URL string:
Expand|Select|Wrap|Line Numbers
  1. "url/"ajax.php?id="+id+"&action="+action
instead of
Expand|Select|Wrap|Line Numbers
  1. "url/ajax.php?id="+id+"&action="+action
Mar 20 '08 #9
vjayis
134 100+
You have an extra double quote in the URL string:
Expand|Select|Wrap|Line Numbers
  1. "url/"ajax.php?id="+id+"&action="+action
instead of
Expand|Select|Wrap|Line Numbers
  1. "url/ajax.php?id="+id+"&action="+action

hi

sorry for the mistake.,

i hav written
Expand|Select|Wrap|Line Numbers
  1. "url/ajax.php?id="+id+"&action="+action
[/quote] like this only.,

instead of giving the full link i just typed it inside the quoutes to replace my web link., just to highlight the link.,

I replace my full code one more time.,


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var id;
  3. var action;
  4. function httprequest(id,action)
  5. {
  6.  
  7. var xmlhttp;
  8. try
  9. {
  10.  xmlhttp=new XMLHttpRequest();
  11. }
  12. catch(e)
  13. {
  14.   try
  15.   {
  16.   xmlhttp=new Activexobject("Msxml2.XMLHTTP");
  17.   }
  18.   catch(e)
  19.   { 
  20.     try
  21.     {
  22.     xmlhttp=new Activexobject("MICROSOFT.XMLHTTP")
  23.     }
  24.     catch(e)
  25.     {
  26.      alert("ur browser doesnot support Ajax");
  27.      return false;
  28.     }
  29.   }
  30.  
  31. }
  32. xmlhttp.onreadystatechange=function()
  33.  if(xmlhttp.readyState==4)
  34.  { 
  35.  
  36.    obj = document.getElementById( "ajax" );
  37.  
  38.    obj.innerHTML = xmlhttp.responseText;
  39.    getBufferText();
  40.  
  41.  }
  42. }
  43.  
  44. xmlhttp.open("GET", "url/ajax.php?id=" + id + "&action=" + action, true);
  45. xmlhttp.send(null);
  46. }
  47.  
  48. function hidden(id,action)
  49. {
  50.  httprequest(id,action)
  51. }
  52. </script>
  53.  
[code-php]

<table id="ajax">------Place where i fetch data from another page and display---------
<tr><td><a onclick="hidden('1','next')">next</a></td></tr>
</table>

[/code]
thanks
Mar 21 '08 #10
acoder
16,027 Expert Mod 8TB
Which line does the error occur on?
Mar 21 '08 #11
vjayis
134 100+
Which line does the error occur on?
Hi

got solution for the problem.,

tried using div tag from the suggestion gave by "gits" in another forum.,

But when the page loads i get an error (only in ie which runs well in firefox)

Error: 'document.getElementById(...)' is null or not an object.

can u give me some t ips.,

thanks
Mar 22 '08 #12
acoder
16,027 Expert Mod 8TB
I assume the error occurs on the following line:
Expand|Select|Wrap|Line Numbers
  1. obj = document.getElementById( "ajax" );
Try using a different ID in case IE has a problem with the "ajax" id.

Failing that, is it possible that you have a test page?
Mar 22 '08 #13
vjayis
134 100+
I assume the error occurs on the following line:
Expand|Select|Wrap|Line Numbers
  1. obj = document.getElementById( "ajax" );
Try using a different ID in case IE has a problem with the "ajax" id.

Failing that, is it possible that you have a test page?


Hi
sorry i couldnt send u a test page.,

Can u tell me whether ajax can be run in ie5 and ie6.,

coz my ajax script is not running in an system which has ie6 installed., i hav tried even by enabling most of the options in browser settings.,

here is my javascript coding

Expand|Select|Wrap|Line Numbers
  1. function httprequest()
  2. {
  3.  
  4.   var xmlhttp;
  5.   try
  6.  {
  7.    xmlhttp=new XMLHttpRequest();
  8.  }
  9.   catch(e)
  10.  {
  11.     try
  12.    {
  13.     xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  14.    }
  15.    catch(e)
  16.    { 
  17.      try
  18.     {
  19.          xmlhttp=new ActiveXObject("MICROSOFT.XMLHTTP")
  20.     }
  21.      catch(e)
  22.     {
  23.      alert("ur browser doesnot support Ajax");
  24.      return false;
  25.     }
  26.    }
  27.  
  28.  }
  29. ------------------------------
  30. }

when i click on the ajax link i got an alert message "ur browser doesnot support Ajax" which i hav given in the script.,

Thanks
Mar 24 '08 #14
acoder
16,027 Expert Mod 8TB
Can u tell me whether ajax can be run in ie5 and ie6.,
Yes, it can. You may need to watch the case - see if this link helps.
Mar 24 '08 #15
vjayis
134 100+
Yes, it can. You may need to watch the case - see if this link helps.


Hi

probably i had also used the same script in my page., but when i click the ajax link in my page., it displays the alert message "ur browser does not support ajax"

Here is my code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script type="text/javascript">
  3. var id;
  4. var action;
  5. function httprequest(id,action)
  6. {
  7.  
  8. var xmlhttp;
  9. try
  10. {
  11.  xmlhttp=new XMLHttpRequest();
  12. }
  13. catch(e)
  14. {
  15.   try
  16.   {
  17.   xmlhttp=new Activexobject("Msxml2.XMLHTTP");
  18.   }
  19.   catch(e)
  20.   { 
  21.     try
  22.     {
  23.     xmlhttp=new Activexobject("MICROSOFT.XMLHTTP")
  24.     }
  25.     catch(e)
  26.     {
  27.      alert("ur browser doesnot support Ajax");
  28.      return false;
  29.     }
  30.   }
  31.  
  32. }
  33. xmlhttp.onreadystatechange=function()
  34.  if(xmlhttp.readyState==4)
  35.  { 
  36.  
  37.    document.getElementById("ajax").innerHTML=xmlhttp.responseText;
  38.  
  39.  }
  40. }
  41.  
  42. xmlhttp.open("GET","ajax.php?id="+id+"&action="+action,true);
  43. xmlhttp.send(null);
  44. }
  45.  
  46. function hidden(id,action)
  47. {
  48.  httprequest(id,action)
  49. }
  50. </script>
  51.  
Expand|Select|Wrap|Line Numbers
  1. <div id="ajax">
  2. <table >
  3. <tr>
  4. <td>------Place where i fetch data from another page and display---------</td>
  5. <td><a onclick="hidden('10','next')">next</a></td>
  6. </tr>
  7. </table>
  8. </div>
  9.  
and in my ajax.php page i hav displayed datas fetched from database which are above the id(10) i sent on onclick event;

but when i click the ajax(next) link., i get an alert message
"ur browser doesnot support Ajax"
in ie5 and ie6;
but its working well with ie7 and firefox.,

and i had even tried changing the id name from "ajax" to someother string., but nothing happened.,

could u help me to get rid of the problem.,

kind regards
vijay
Mar 25 '08 #16
acoder
16,027 Expert Mod 8TB
You've made the same mistake. Remember JavaScript is case-sensitive.

Activexobject should be ActiveXObject.

What I suggest is that you copy the code from the linked page and then try that.

The reason why it works in IE7/Firefox is that they both support the XMLHttpRequest object.
Mar 25 '08 #17
vjayis
134 100+
You've made the same mistake. Remember JavaScript is case-sensitive.

Activexobject should be ActiveXObject.

What I suggest is that you copy the code from the linked page and then try that.

The reason why it works in IE7/Firefox is that they both support the XMLHttpRequest object.

Hi

thanx., got the solution.,

ajax is working well in ie6.,

but after the page gets loaded.,

the status bar displays the message.,
"error on page." does my javascript made some errors., ??

could you help me in this

regards
Mar 26 '08 #18
acoder
16,027 Expert Mod 8TB
but after the page gets loaded.,

the status bar displays the message.,
"error on page." does my javascript made some errors., ??
Yes, you've got some errors. Double click the error icon and see what the error is.
Mar 26 '08 #19
vjayis
134 100+
Yes, you've got some errors. Double click the error icon and see what the error is.

Hi

got the solution by finding the errors.,

thanks
regards
vijay
Mar 28 '08 #20
acoder
16,027 Expert Mod 8TB
No problem, glad it's all working.
Mar 31 '08 #21

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by =?Utf-8?B?bWNpbWFnaW5n?= | last post: by
3 posts views Thread by nnaveenraju | last post: by
21 posts views Thread by sheldonlg | last post: by
reply views Thread by Julien Hoffmann | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.