dimanche 11 janvier 2015

Callbacks inside an object


Vote count:

0




Why doesn't this work


I have an ajax function via jquery inside an object, and for some reason it's not seeing the other functions in the object inside the callback function.



function object {

this.test = function () { alert ("test") }

this.makeQuery = function()
$.ajax( {
url: stuff
dataType: "xml",
success: function (data) { makeData(data) } )

}

this.makeData (data) {
this.data = data
this.test(); // Error "this.test() is not a function"
}

}


asked 1 min ago







Callbacks inside an object

Aucun commentaire:

Enregistrer un commentaire