473,802 Members | 2,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

jQuery - $.ajax() XMLHttpRequest. ResponseText Property Inaccessible

164 Recognized Expert New Member
I am working with jQuery v1.6. My question is: why does the responseText property returning undefined?

Expand|Select|Wrap|Line Numbers
  1. var AjaxResult = jQuery.ajax({ ... });
  2.  
  3. console.log(AjaxResult);
  4.  
  5. // logs "Object {readyState=1, ...}"
  6. // So I know that the object is being returned.
  7.  
  8. console.log(AjaxResult.responseText);
  9.  
  10. // This line outputs "undefined" to the console.  
  11. // I have no idea why since the object is being returned.
  12.  
Full script attached as text file.
Attached Files
File Type: txt ajaxLogin.txt (2.5 KB, 429 views)
Sep 20 '11 #1
1 4257
Dormilich
8,658 Recognized Expert Moderator Expert
first
The jQuery XMLHttpRequest (jqXHR) object returned by $.ajax() as of jQuery 1.5 is a superset of the browser's native XMLHttpRequest object.
second
the responseText property is populated, after the server returned a result. for an asynchronous call, JavaScript is faster, hence the responseText property is not yet populated.
Sep 21 '11 #2

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

Similar topics

11
3389
by: Elizabeth | last post by:
I'm fetching some HTML files with XMLHttpRequest and dumping the ResponseText into block elements; works fine except that single and double quotes are being displayed as question marks (inside of a black diamond in FireFox) What's going on ? What is the workaround ? I've tried this: divElement.innerHTML = x.responseText.replace(/\?/g, "'") but it does nothing ... even if it did work it would not be distinguishing "
2
32524
by: dean.h.brown | last post by:
I'd like to create a slideshow using the same technology that Google Maps uses: Load/unload images offscreen and the user can drag the images around. Dragging the images is easy (http://www.walterzorn.com/dragdrop/dragdrop_e.htm) But I haven't found a way to load the images as needed (There may be 100's so I don't want to load them all when the page loads)
6
7817
by: mihirnmehta | last post by:
This is my code function getDetails() { var name = document.getElementById("movie_name").value; if (window.XMLHttpRequest) //For Mozilla Browsers { XMLHttp=new XMLHttpRequest() }
1
1838
by: shiniskumar | last post by:
i go tto perform some validation while ck=liking a button without refreshing the value.. i used ajax.My code is as follows...on button click i call the function validateGridAdd(); Inside tat function i need to call the function tat uses ajax to go to the server and come back.. the resultant value is to be obtained in the main function validateGridAdd(). //main function function validateGridAdd(a,rowNum){ var tForm =...
0
1482
by: Salim | last post by:
Hi, There is a problem with CollapsiblePanelExtender CollapsiblePanelExtender1.Collapsed property always returns false even when I collapse or expend. Thanks in advance.
2
5892
by: Angus | last post by:
Hello I want to get an Ajax example working with a Perl script. I have this at the moment but nothing seems to get sent to the server self.xmlHttpReq.open('GET', 'http://myurl.com/example.pl?name=lisa', true); self.send(); But as I say nothing gets sent.
5
6638
by: wendallsan | last post by:
Hi all, I'm running into a situation where it seems that JS stops executing as soon as I call an eval in my script. I have an Ajax.Request call to a PHP page that builds a JS object and returns it as the responseText. I want to attach that object to the document (or anywhere else that would allow me to access it later), and to do that, I THINK I need to eval it because it's just a string otherwise. My problem is as soon as I execute a...
1
1764
by: par7133 | last post by:
Hi, Yea, XMLHttpRequest give out a crossbrowser problem managing the status change of the connection. Here the solution: var xmlhttp; xmlhttp=null;
1
2246
by: littlecoder | last post by:
hi, I am returning a string "hello" from an ajax page and retrieveing it with object.responseText ;like echo "hello" ; var test = object.responseText; but the statement below is not working... Any idea ? if(test=="hello")
3
2062
by: marymcd | last post by:
Hello, I am trying to fix a web/database problem (someone else wrote) and am not that familiar with Java or Ajax. The code opens a list when data is typed in a text input field but the "onkeyup" selection is not what is written to the database. For example: I type "Ma" in a text box. A list of names appears: "Maggie", "Margaret", "Mary". I click on "Mary" to select it and submit the page. When I check the data input in the...
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9561
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10532
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10302
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10058
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9111
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7597
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6835
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.