I have a little problem. When I call
myVar = $.post('/check_2/', JSON.stringify({"newname": window.NEWNAME,}), callback, 'json')
in 'myVar' I have an object, so, when I do console.log myVar, I get something like:
Object {readyState: 1, setRequestHeader: function, getAllResponseHeaders: function,getResponseHeader: function, overrideMimeType: function…}
abort: function (a){a=a||"abort",p&&p.abort(a),w(0,a);return this}
always: function (){i.done.apply(i,arguments).fail.apply(i,arguments);return this}
complete: function (){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this}
[...]
If I make console.log myVar.success (for example), It prints what it's shown in success, but, if I make console.log myVar.responseText (where the result of the call is), I keep getting undefined, so I can never really access the data I'm interested in.
Any ideas how can I access that data??
I know that I'm misunderstanding something about post calls, but as I have the misunderstanding, I don't know what I'm doing wrong.
I used post instead of get because I really need to send data to the backend, so I can make some checks in DB
EDIT: Where I make console.log:
check2: (callback) ->
console.log "Starting..."
myVar = $.post('/check_2/', JSON.stringify({"newname": window.NEWNAME,}), callback, 'json')
console.log myVar
console.log "success example"
console.log myVar.success
console.log "responseText"
console.log myVar.responseText
EDIT 2
Here's a photo of the object being showed by console.log myVar

console.log(inside or outside the callback)?callback. As it stands you are simply settingmyVarto the promise returned by the$.post. If you show us what you want to do with the data, we can probably provide better help.