السبت، 17 أغسطس 2013

Using this for a function while using $.post

By Unknown   Posted at  3:05 م   jQuery Forum 1 comment

I'm trying to access this in a function/class to access another function but I keep getting the following error:


Uncaught TypeError: Object #<Object> has no method 'SetOptions'



Here is my code:





  1. this.newFilter = function() {

  2. var info = this.getProductInfo();

  3. var r = isEmpty(info.range) ? '' : info.range;

  4. var g = isEmpty(info.grade) ? '' : info.grade;

  5. var s = isEmpty(info.species) ? '' : info.spacies;

  6. var t = isEmpty(info.thickness) ? '' : info.thickness;

  7. $.post("ajax.php", {range: r, grade: g, species: s, thickness: t}, function(data) {

  8. var obj = false;

  9. try {

  10. obj = JSON.parse(data);

  11. }

  12. catch (error) {

  13. return;

  14. }

  15. this.SetOptions("grade", obj.grade);

  16. this.SetOptions("species", obj.species);

  17. this.SetOptions("thickness", obj.thickness);

  18. });

  19. }


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

About the Author

Nulla sagittis convallis arcu. Sed sed nunc. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.
View all posts by: BT9

هناك تعليق واحد:

Back to top ↑
Connect with Us

© 2013 jQuery Forum. WP Mythemeshop Converted by Bloggertheme9
Blogger templates. Proudly Powered by Blogger.