title: How to hide serious business logic in JS file
body: <p>In our recent applications we are using lots of AJAX in JS files to avoid frequent postbacks. But I'm worried about the public getting into some of our business logic by just checking the JS file. They can also alter the data being sent to the server using firebug or such features. So how can we avoid this scenario and protect our code from being easily visible to the world.</p>
  
  <p>In this case, the public can see the server side function, parameters etc easily. So how can we avoid this headache to some extent.</p>
  
  <pre><code>var param = { id: id };
  var param = JSON.stringify(param);
  $.ajax({
      type: "POST",
      url: "qmaker.aspx/deleteQuestion",
      data: param,
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      global: false,
      beforeSend: function () {
          $.blockUI({
              message: '&lt;h3&gt;Deleting Question..&lt;br&gt;&lt;small&gt;Please wait for a moment...&lt;/small&gt;&lt;/h3&gt;'
          });
      },
      success: function (data) {
          if (data.d == 1) {
              var n = noty( type: 'success', text: 'Question Deleted successfully.', /* ... */)
              var oTable = $('#table_question).DataTable();
              var row = oTable.row($(that).parents('tr:first'));
              /* ... */
  </code></pre>