This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

erodriguez
erodriguez

After make a successful request, I'm not able to access to the object data because is undefined. Just in case, I'm follwing the next example from the documentation.

data-request-success="console.log(data)"

The error message:

Uncaught ReferenceError: data is not defined

My response

{"id":60,"disk_name":"6096044a82363370644947.jpg","file_name":"123049664_10157982302309613_6279917934524275332_n.jpg","file_size":522702,"content_type":"image\/jpeg","title":null,"description":null,"field":"avatar","sort_order":60,"created_at":"2021-05-08 03:23:54","updated_at":"2021-05-08 03:23:54","path":"http:\/\/localhost\/peruguitar\/storage\/app\/uploads\/public\/609\/604\/4a8\/6096044a82363370644947.jpg","extension":"jpg"}
daftspunky
daftspunky

Hi erodriguez,

We are making an attempt to discourage the use of this attribute (data-request-success) because it causes some security policies to fail (use of unsafe eval function). We will eventually phase it out of all core implementations but keep the attribute for legacy codebases.

It would be ideal if you could also refactor this out to use the JavaScript API instead, for future-proofing. However, if this is not possible, we have restored the data argument in the next release (v2.0.13) which should be released in a couple of days. This will bring it back into line with the documentation

If there is no "safe" way to handle this, we will eventually remove it from the documentation.

Thanks

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.