0

How can I change Url for ajax response for children?

E.g. I have

onLazyRead: function (node) {
          $.ajax({
            url: "http://google.com"
            ...
})

and load any children. I want by clicking on children click also load by ajax, but from another action, not from "http://google.com". How can I change it for children nodes?

uladzimir
  • 5,639
  • 6
  • 31
  • 50

1 Answers1

1

you can add url (or whatever you want) property to your child nodes and use as

onLazyRead: function (node) {
          $.ajax({
            url: node.data.url
            ...
})
Orifjon
  • 915
  • 8
  • 25
  • >> you can add url (or whatever you want) property to your child nodes But how? I can't find it in documentation – uladzimir Dec 23 '13 at 11:03
  • I only found that there is "node.data.key" option and I can make response from server accordingly with node's key – uladzimir Dec 23 '13 at 11:04
  • to be more clear, you can use `node.data` property for this. and on your onLazyRead, use it as `url: node.data.url` – Orifjon Dec 23 '13 at 11:11
  • Ok. And node.data.url - parameter from server? I can't find supported option url. Is it custom? sorry, i'm newbie – uladzimir Dec 23 '13 at 11:24
  • Yes, it is custom. on documentation, it states "Use this attribute to access all node options that were passed to create this node. For example `node.data.title` or `node.data.tooltip`." (You can pass url as option) – Orifjon Dec 23 '13 at 11:33