drupal json server, objects with ## symbol in javascript?!

I am using the services module in drupal a long with the JSON Server, and I am accessing it using jQuery this works great, but I have one small problem. Drupal/JSON Server always seem to return objects with the # symbol, which I don't really know how to handle, this prevents me from doing object.property Because in reality it's object.#property but obviously javascript gives error here, so should I just run a regex and replace the "#" symbols or what do I do? Example, I invoke some method using a jQuery post, and it returns data such as, a console.log would spit out this: Object #data: Object #error: true #message: "Already logged in as admin." __proto__: Object #error: false __proto__: Object Now it works great it returns the data I need etc, but I want to be able todo: object.message , but it wont let me because of the # and I can't do object.#message So either javascript have some funny thing built in for this, or I need to delete all the "#" but that does not seem like such a good solution to me, don't ask me why drupal returns objects with this symbol as part of the name, I suppose it has some kind of use or meaning but I have yet to understand that Forgive my ignorance if it's something "obvious" :D Also I suppose a regex would just make my app slower if these are big json objects/strings so rather not, right? Thanks!

以上就是drupal json server, objects with ## symbol in javascript?!的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准