473,320 Members | 2,158 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,320 software developers and data experts.

Problem in ajax code like this.object is not defined

Dear Friends ,

I am new in ajax .Follwoning code give error -

Expand|Select|Wrap|Line Numbers
  1.  
  2. var ajaxpack=new Object()
  3. ajaxpack.basedomain="http://"+window.location.hostname
  4. ajaxpack.ajaxobj=createAjaxObj()
  5. ajaxpack.filetype="txt"
  6. ajaxpack.addrandomnumber=0 //Set to 1 or 0. See documentation.
  7.  
  8. ajaxpack.getAjaxRequest=function(url, parameters, elemid, filetype){
  9. ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
  10. if (ajaxpack.addrandomnumber==1) //Further defeat caching problem in IE?
  11. var parameters=parameters+"&ajaxcachebust="+new Date().getTime()
  12. if (this.ajaxobj){
  13. this.filetype=filetype
  14. this.ajaxobj.onreadystatechange=function()
  15. {
  16.       if(this.ajaxobj.readyState==4)
  17.         {
  18.         document.getElementById(elemid).innerHTML=this.ajaxobj.responseText;
  19.         }
  20.  
  21.  
  22. }
  23.  
  24. this.ajaxobj.open('GET', url+"?"+parameters, true)
  25. this.ajaxobj.send(null)
  26. }
  27. }
  28.  



Error: this.ajaxobj has no properties
Source File: http://localhost/ajax/ajaxroutine.js
Line: 39

line 39 is
if(this.ajaxobj.readyState==4)

i donot understand that why its give error because i am working on current object which is defined earlier .


Gunjan
May 4 '08 #1
3 2963
acoder
16,027 Expert Mod 8TB
Can I see your createAjaxObj() function?

Mos likely you'll want to use ajaxpack.ajaxobj in place of this.ajaxobj.
May 4 '08 #2
problem is solved when i use ajaxpack.ajaxobj in place of this.ajaxobj

Thank you for solving my problem


Gunjan
May 4 '08 #3
acoder
16,027 Expert Mod 8TB
You're welcome. Glad you got it working. Post again if you have more questions.
May 4 '08 #4

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

Similar topics

42
by: Greg | last post by:
Hi, I've designed a bookmark in Ajax / PHP that I will put soon on sourceforge.net. But I've got an very tricky bug. I try it on some computers with Internet Explorer/Windows, Firefox...
14
by: squash | last post by:
The following code works fine in Firefox/Netscape but wont work in IE. I suspect the problem is with one of these two simple functions. If there is no obvious error Ill paste the entire code. ...
10
by: lkagan2000 | last post by:
I'm reading 'Ajax in Action', (one of the best of the many tech books I've read) and there's an example that I just don't fully understand. If you happen to have the book, it's on page 75. I'm...
1
by: monudjn | last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem The Problem: While submitting the form i am getting...
3
by: Simon | last post by:
I have the following code in Javascript which is creating and sending an XMLHttpRequest . <code> var xmlHttp; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlHttp = new...
11
by: trpost | last post by:
I am using ajax / php where I am looking up some info from the database and populating a select list dynamically, however I am running into some sort of size limitation with the ajax.response...
16
by: Victor | last post by:
I have a strange problem in my website. I configured my website to run under 2 worker processes. (web garden enabled). and I stored my user information in the current httpcontext(like...
1
by: JohnnieTech | last post by:
I am using some javascript/ajax to load content into a main div. The problem I am running into is that it will work in IE but not in FF. In FF I don't get any sort of load at all. I have a 1...
8
by: Samik R. | last post by:
Hello, I am using the innerHTML property of a div placeholder to update the contents, and the HTML is provided from a perl script on the server side. The perl script gets called through AJAX when I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.