TypeError : transport.responseText has no properties
Reported by Chris Henry | May 27th, 2008 @ 07:45 PM
Occasionally, String#evalJSON will throw a typeError which states that transport.responseText has no properties. Logging transport and inspecting shows the responseText is indeed there.
A quick code sample:
new Ajax.Request(url, {
method : 'post',
parameters : params,
onComplete : function(transport) {
var myJSON = jsonTransport(transport);
//do stuff with myJSON
}
});
function jsonTransport(transport) {
try {
return transport.responseText.evalJSON();
} catch (e) {
console.log(e, transport)
}
}
Comments and changes to this ticket
-
John-David Dalton August 25th, 2008 @ 04:36 PM
- → Tag changed from to evaljson json
Have you tried to access the property directly console.log(transport.responseText);
-
Mark Caudill August 27th, 2008 @ 02:49 AM
Likely just a result of invalid JSON, I'm curious what your jsonTransport function logs as well.
-
Tobie Langel August 28th, 2008 @ 01:30 AM
- → State changed from new to inactive
You should be using the responseJSON property instead.
This looks like an issue on your side.
Please feel free to reopen with a failing test case.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
