Fixing JS error on dataRequested event

The js assumes that targetId isn't null, but it is if there is no
attribute.

Pull Request: master