I've a simple MVC model. I'm doing an Ajax request where I send some data to be processed by PHP and retrieve database records as JSON. As this object could be quite large, is there some way I could compress/encrypt it on the PHP (server side) and decrypt it on the Javascript side (client)
$.ajax({
url: "/php/function/link/",
dataType: 'json',
data: {
"date": date,
},
type: "POST",
success: function(_data){
// load encrypted data here and decrypt it.
},
error: function() {
alert("Some error fetching!");
}
I tried using the following methods, but they didn't seem to work (I was getting error while decompressing them on the javascript end):
Are there any other better ways? I simply need to :
compress data on javascript to be passed from client->send it to server (PHP) -> decompress it and compute database queries -> compress it -> pass it to javascript(client side) -> decompress it