responsetext

Why can't I set a variable equal to an XMLHttpRequest's responseText value?

If I am within my XHR's onreadystatechange function, I can easily do document.title = xhr.responseText, but if I make the function return the responseText, I can't set a variable equal to my XHR's outerlying wrapper to make it equal the response; is there any way to go about doing this? My wrapper: ajax = function(url, cb) { xhr =...

jquery ajax get responsetext from http url

neither: var response = $.ajax({ type: "GET", url: "http://www.google.de", async: false, success : function() { alert (this); } }); nor: var response2 = $.get("http://www.google.de", function(data){ alert("Data Loaded: " + data); } ); give me an object, ...

Comet, responseText and memory usage

Is there a way to clear out the responseText of an XHR object without destroying the XHR object? I need to keep a persistent connection open to a web server to feed live data to a browser. The problem is, there is a relatively large amount of data coming through (several hundred K per second constantly), so memory usage is a big problem...

Why is my jQuery.ajax response empty with Django

I'm trying to return a JSON response from a Django view call via an ajax call like below: var tab = 'test'; var response = $.ajax({ url: "/" + tab + "/" }).responseText; alert(response); Here is my Django view: if request.is_ajax() == True: req = {} req['html'] = '<b>This is a test</b>' response = simplejson.dumps(re...

Servlet --x--> Ajax: Ajax code not receiving servlet response.

Hello - I'm unable to figure out what is going on here in this ultra simple example. Problem Summary: I have a simple servlet that appears to run just fine if I drive it manually... by issuing its URL from the browser. By 'just fine' I mean: I can see in the browser HTML page whatever I write in the servlet response. However, if I issu...

Prototype Ajax.Updater Response OK, but not showing up in FF. working in Safari!

Hi, I've got a quite strange problem here. I'm calling some simple code via Ajax.Updater: new Ajax.Updater('load','http://myurl.com/demo.pl?key=demokey&amp;param1=xyz&amp;param2=abc',{ method:'get', onComplete:function(transport){ alert(transport.responseText) } }); which gets some code like this: <img id="2009_04_15_...

Blank responseText in XMLHttpRequest when running in custom protocol in FireFox?

I am writing a FireFox add-on that displays webpages from my server as control and info panels. These panels were written and work in regular URLs, but when I try to access them through a custom protocol (so it's like about:, just myplugin:settings) every XMLHttpRequest returns blank as if I was doing XSS stuff. I know the data's getti...

jQuery Ajax How Do I Pass responseText as variable to indexOf?

Hello, I am trying to append a p element from the responseText of an Ajax request. Before appending, I would like to see if the responseText already exists in the parent div element text, and not add it if that is the case. The problem is I cannot get indexOf(responseText) to work using the variable responseText. My code works when ...

cleanup newlines in responseText

I found the following code in one of the pages I have to maintain; document.getElementById('dummy').innerHTML = httpRequest.responseText; return document.getElementById('dummy').innerHTML; expecting it to do nothing, I replaced it with return httpRequest.responseText; but then the script choked on the input. It turned out that ther...

Ajax: Change responseText font color based on result

Hi. Programmers here have been extremely helpful in resolving issues for me in the past, so I thought I'd ask an Ajax question. It's probably a simple fix, but I'm new to Ajax. What I'd like to do is change the style of the responseText to red if the result is the pharase, "NOT FOUND". Otherwise the text will be black. Here is the scr...

Cant use any string functions on xmlhttp response text in VBScript

I can't do anything with the response text from the below code other than print it to the screen. I want to use an if statement to check what the response text is,but whenever I try this it prints nothing. For the sake of this example, assume the response text is "2" Code: Set xmlhttp = server.CreateObject("MSXML2.XMLHTTP") xmlhttp.op...

Ajax or JavaScript: Changing Style According to Server Response

Hey, I'd like to change the font color or the responseText based on the result. For example, if the responseText is NOT FOUND, I'd like to font color to be red. Otherwise, it will be black. It's currently displaying the correct responseText; I just want to change the color when necessary. Here is my current Ajax: function newXMLHt...

Ajax - How Do I Populate a Hidden Field?

Hi. I'm new to Ajax. I'd like to populate a hidden field on a form with a responseText from the server. I'm able to display the responseText in the HTML as an innerHTML. I'm just unsure how to populate the hidden field on the form. Any suggestions will be greatly appreciated! :) Here's the JS: function getLocation(locationroutin...

Why can I not return responseText from an Ajax function?

Here is part of my Ajax function. For some reason that I cannot figure out, I am able to alert() responseText but not able to return responseText. Can anybody help? I need that value to be used in another function. http.onreadystatechange = function(){ if( http.readyState == 4 && http.status == 200 ){ return http.responseTe...