jQuery
I'm having a few problems with jQuery. On jQuery 1.5.1, my ajax calls would return as "error" (ie, they trigger the 'error' ajax callback; no error is raised in zombie), even though the request returns with 200 status. Reverting to 1.4.4 solved this problem, however I then noticed that setting content using jQuery .html(newHtml); was also failing. Using native javascript .innerHtml = newHtml; solved this problem.
Sorry that I can't be more specific about what's going on here -- I'm still getting to know node and zombie.
I'm having the same problem : ajax calls don't work anymore with jQuery 1.5. I'm using capybara-zombie and here is the stack trace I get :
#<JSON::ParserError: 705: unexpected token at '"TypeError: Object [object Object] has no method 'getAllResponseHeaders'
at [object Object].<anonymous> (/jquery-1.5.min.js:16:72287)
at [object Object].<anonymous> (/usr/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/xhr.js:20:44)
at Array.1 (/usr/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/xhr.js:2:61)
at EventEmitter._tickCallback (node.js:108:26)"'> (MultiJson::DecodeError)
bump
I hit the same error as kookoolen with jQuery v1.5, node v0.4.2, npm v0.3.15. Playing with capybara-zombie as well.
Also ran into this issue with jQuery 1.5.1. The errorThrown object passed to $.ajax.error is:
errorThrown: {
stack: [Getter/Setter],
arguments: [
'getAllResponseHeaders', {
readyState: [Getter],
status: [Getter],
statusText: [Getter],
abort: [Function],
send: [Function],
setRequestHeader: [Function],
getAllResponseHeader: [Function],
getResponseHeader: [Function],
open: [Function],
_error: null,
onreadystatechange: [Function],
responseText: [Getter],
responseXML: [Getter]
}
],
type: 'undefined_method',
message: [Getter/Setter]
}
Reverting to 1.4.4 solved this, but we've already migrated the site to jQuery 1.5.1, so this isn't really a solution for me. I'm looking forward to being able to use zombie.js + vows.js to fully test all our JS functionality, but this is kind of a show stopper for now.
I would be more than happy to help solve this issue.
Please re-open if still an issue in 0.10.
jQuery AJAX calls are still failing with jQuery 1.6 and Zombie. I get this to the jQuery.ajax error callback:
{ readyState: 4,
setRequestHeader: [Function],
getAllResponseHeaders: [Function],
getResponseHeader: [Function],
overrideMimeType: [Function],
abort: [Function],
pipe: [Function],
always: [Function],
then: [Function],
promise: [Function],
isRejected: [Function],
isResolved: [Function],
fail: [Function],
done: [Function],
success: [Function],
error: [Function],
complete: [Function],
statusCode: [Function],
status: 0,
statusText: 'error' }
Here's browser.dump:
Zombie: 0.11.6
URL: http://localhost:3000/test/index.html
History:
1: http://localhost:3000/test/index.html
Cookies:
Storage:
localhost:3000 session:
qunit-vie.js - DBPedia Service-VIE.js DBPediaService - Load = 1
Eventloop:
The time: 1322731340574
Timers: 0
Processing: 0
Waiting: 0
Document:
<html version="XHTML+RDFa 1.0" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <script type="text/javascript" src="../lib/jquery/1.6/jquery-1.6.1.min.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="../lib/rdfquery/latest/jquery.rdfquery.debug.js"></script>
<script type="text/javascript" src="../lib/underscoreJS/underscore.js"></script...
For us the problem is that we depend on jQuery Deferred, and so can't even try to downgrade.
It seems jQuery 1.7.x AJAX calls work fine: https://github.com/bergie/zombie-qunit
I'm using Zombie: 0.12.13
I experienced same problem as "6twenty" March 01, 2011, where my ajax calls were returning as errors (even the request showed 200 status code)
Example code:
function LoadProfessionalsByCat(idcat, scope){ $.ajax({ url: '/api/users/bycat', data: {id:idcat, scope : scope}, dataType: 'jsonp', success: function (data) { // ->> if run in the browser, this success call back was triggered (everything ok) viewModel.professionals (data.users); }, error:function (res){ // ->> if run in Zombie, this error callback was triggered, but there was no ERROR in the response (status code=200, the data returned looked ok, etc..) console.log (res) } }); }
I got this behaviour with jQuery 1.6.4 and jQuery 1.7. I downgrade to 1.4.4 and everything seems to work fine.
I am using node 0.6.6
Hope it helps!
using this syntax (url, {data}, callback):
$.getJSON(query.url, {id:id}, function (data)
instead of ({url:url, data:data, success: callback}):
$.ajax({ url: query.url, data: {id:id}, dataType: 'jsonp', success: function (data) {
worked for me! (jquery 1.7)