I'm trying to access this in a function/class to access another function but I keep getting the following error:
via jQuery Forum http://forum.jquery.com/topic/using-this-for-a-function-while-using-post#14737000004463902
Uncaught TypeError: Object #<Object> has no method 'SetOptions'
Here is my code:
- this.newFilter = function() {
- var info = this.getProductInfo();
- var r = isEmpty(info.range) ? '' : info.range;
- var g = isEmpty(info.grade) ? '' : info.grade;
- var s = isEmpty(info.species) ? '' : info.spacies;
- var t = isEmpty(info.thickness) ? '' : info.thickness;
- $.post("ajax.php", {range: r, grade: g, species: s, thickness: t}, function(data) {
- var obj = false;
- try {
- obj = JSON.parse(data);
- }
- catch (error) {
- return;
- }
- this.SetOptions("grade", obj.grade);
- this.SetOptions("species", obj.species);
- this.SetOptions("thickness", obj.thickness);
- });
- }
The lines this.SetOptions(...); that is the function I am trying to access within the function. How can I do this in a $.post?
via jQuery Forum http://forum.jquery.com/topic/using-this-for-a-function-while-using-post#14737000004463902
inspiring page about us, you are welcome to read it
ردحذف