is it safe to pass data via ajax?

前端 未结 2 567
时光取名叫无心
时光取名叫无心 2021-01-26 08:59

i created script which will count child\'s div for some certain div with this command

$(\'#content\').children().size()

by this count i know to

2条回答
  •  伪装坚强ぢ
    2021-01-26 09:48

    As per my comment, once more as answer.

    'Safe' is relative. Basically AJAX is nothing but a plain HTTP request based on JavaScript. So it's not any more or less safe than one like that. To make it 'safe' you could use HTTPS to encrypt the connection. That way, you should be able to prevent injection and stuff. Regarding the cheating...if one really wants to, he can. The only thing you can do, is to check the parameters carefully and therefore detect irregularities. Maybe add a hidden checksum, which only allows for particular options.

提交回复
热议问题