I am making a web app that has typical javascript structure below. I must hide at least a function or some formulas from the public code because someone can save the page on his computer without paying for the web app membership. I am not sure how to do that.
"edit" I found the answer and is in the following snippet. My problem now is how to pass the data outside the $.post( )?
function analysis(){
var L = "sting";
var w = JSON.stringify(w);
var counter = "sting";
$.post('../php/solver2.php',{L : L , w : w , counter:counter },
function(data){ jdata = JSON.parse(data); });
var jdata = JSON.parse(tempJdata);
var x = jdata.x;
var v = jdata.v;
return [x v];
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script>