Reputation: 2394
In coffeescript, I'm using this to load a json file
$.ajax 'json/data.json',
success : (res, status, xhr, data) ->
console.log("yea "+data)
error : (xhr, status, err) ->
console.log("nah "+err)
complete : (xhr, status) ->
console.log("comp")
file loads but data comes up is undefined?
Upvotes: 0
Views: 2428
Reputation: 193261
Success takes different set of arguments:
success
Type: Function( Object data, String textStatus, jqXHR jqXHR )
Try this:
$.ajax 'json/data.json',
success : (data, status, xhr) ->
console.log("yea "+data)
error : (xhr, status, err) ->
console.log("nah "+err)
complete : (xhr, status) ->
console.log("comp")
Upvotes: 1