AnchovyLegend
AnchovyLegend

Reputation: 12537

Secure ajax data for submission

I am trying to use AJAX to securely submit data to a script. After collecting the below values, I am trying to somehow, transmit the collected values, securely, to process.php however, I have never done this before.

I appreciate any suggestions on how to encrypt or somehow secure the below data and submit it with ajax.

My JQuery

       $('.process-button').click(function(){
            var processNum = $('.process-num').val();
            var month = $('.process-month').val();
            var amount = $('.charge-amount').val();


            $.ajax({
                url: "process.php",
                type: "post",
                success: function(data){
                    alert(data);

                }
            });         
        });

Many thanks in advance!

Upvotes: 2

Views: 280

Answers (1)

Katana314
Katana314

Reputation: 8610

There may be more that others can point out, but a few security concepts I can think of:

  • Transmit data using HTTPS. You may need to set up your server software for this. The page you post from may also need to be in HTTPS (so that it will be the same domain)
  • Do not include any information in the URL, like you often might in a GET request. (ie, POST "provider/patienthistory/patients/frankgumby/"). This is mostly handled by doing it as a POST request.
  • On PHP, do not trust off the bat that the information is coming from that Javascript call. Assume someone is sending requests from a random page on your site, with made-up data, and ensure said person cannot do anything malicious.

Upvotes: 2

Related Questions