Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS/jQuery] pole klasy nie dziala.., jquery praktycznie nie ma
marki
post 9.10.2011, 12:42:02
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 6.06.2011

Ostrzeżenie: (0%)
-----


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.


Ten post edytował marki 9.10.2011, 12:42:38
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
erix
post 11.10.2011, 14:13:00
Post #2





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Pomożemy, jeśli wystawisz to na żywo.

Ty korzystasz z firebuga, pozwól i nam.


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 03:27