Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JS/jQuery] pole klasy nie dziala..
Forum PHP.pl > Forum > XML, AJAX
marki
Mam problem.. zdefiniowałem obiekt:
  1. <script type="text/javascript">
  2.  
  3. var ppp = {
  4. _likedata:{id:0,url:""},
  5. constructor : function(){
  6. this.__defineGetter__("likedata", function(){
  7. return this._likedata;
  8. }),
  9.  
  10. this.__defineSetter__("likedata", function(val){
  11. this._likedata = val;
  12. })
  13. },
  14.  
  15.  
  16. getLikeData : function() {
  17. if(this.getlikeid()!=0){
  18. this.getData('likes', '{"id" : "' + this.getlikeid() + '"}');
  19. }
  20. else{
  21. this.getData('likes', '');
  22. }
  23. },
  24. setlikeurl:function(url){
  25. this._likedata.url=url;
  26. },
  27.  
  28. setlikeid:function(id){
  29. this._likedata.id=id;
  30. },
  31. getlikeid:function(){
  32. return this._likedata.id;
  33. },
  34. getlikeurl:function(){
  35. return this._likedata.url;
  36. },
  37. renderLike: function() {
  38. this.getLikeData();
  39. $('#likes').html('<fb:like href="' + this.getlikeurl() + '" layout="button_count" show_faces="false" width="65" action="like" font="segoe ui" colorscheme="light" />');
  40. if (typeof FB != "undefined") {
  41. FB.XFBML.parse(document.getElementById('like'));
  42. }
  43. },
  44.  
  45. getData : function (ltype, sendJson) {
  46. var like;
  47.  
  48. $.ajax({
  49. type: "POST",
  50. url:"/get-Points/" + ltype,
  51. data: sendJson,
  52. dataType:"json",
  53. beforeSend: function(x) {
  54. if (x && x.overrideMimeType) {
  55. x.overrideMimeType("application/json;charset=UTF-8");
  56. }
  57. },
  58. error: function(data) {
  59. //em
  60. },
  61. success: function(data) {
  62.  
  63. if (data.systemError != undefined) {
  64. window.location.href = "/auth/login";
  65. }
  66. if (data.likeError != undefined) {
  67. $('#' + ltype).html('<p>' + data.likeError + '</p>');
  68. jQuery.extendedjsoncookie("removeCookie", "g" + ltype);
  69. }
  70. else {
  71. this.setlikeid(data.id);
  72. this.setlikeurl(data.url);
  73. //this._likedata.id=data.id;
  74. //this._likedata.url=data.url;
  75.  
  76. // this.likedata=data;
  77. // jQuery.extendedjsoncookie( "setCookieVariable","g"+ltype+i, "url", data.buttonsData.url);
  78. // jQuery.extendedjsoncookie( "setCookieVariable","g"+ltype+i, "id", data.buttonsData.id);
  79. }
  80. }
  81. });
  82. }
  83. }

Problem jest taki, że firebug mówi:
- jeśli nie używam getterów/setterów że _likedata nie istnieje
- jeśli ich używam- wg firefoxa nie są funkcjami.. tzn uruchamiając w konsoli ppp.setlikeurl("costam") dziala ale w kodzie this.setlikeurl("cosinnego") juz nie.
Łysięję już i mam dość. Pomocy.
erix
Pomożemy, jeśli wystawisz to na żywo.

Ty korzystasz z firebuga, pozwól i nam.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.