title: How to handle X-CSRF-Token for jQuery POST in UI5?
body: <p>I want to use jQuery POST method to call an xsjs service that does some modifications in Database.My xsaccess file prevents xsrf, so  I need to handle it in my controller method.</p>
  
  <p>Below is my controller code-</p>
  
  <pre><code>    var obj= {};
            obj.name= "John";
            obj.age= "abc@xyz.com";
            obj.loc= "Minnesota";
  
      jQuery.ajax({
              url: "serviceTest.xsjs",
              type: "GET",
              data: JSON.stringify(obj),
              beforeSend: function(xhr) {
                  xhr.setRequestHeader("X-CSRF-Token", "Fetch");
              },
              success: function(responseToken, textStatus, XMLHttpRequest) {
          var token = XMLHttpRequest.getResponseHeader('X-CSRF-Token');         
                  console.log("token = " +token);
                  jQuery.ajax({
                      url: "serviceTest.xsjs",
                      type: "POST",
                      data: JSON.stringify(obj),
                      beforeSend: function(xhr) {
                          xhr.setRequestHeader("X-CSRF-Token", token);
                      },
                      success : function(response) {
                           // will be called once the xsjs file sends a  
                              response
                           console.log(response);
  
                       },
                       error : function(e) {
                           // will be called in case of any errors:
                           var errMsg = e.responseText
                           console.log(e);
  
                       }
                  });
              },
  </code></pre>
  
  <p>And here is my xsjs code-</p>
  
  <pre><code>    var csrf_token = $.request.headers.get("X-CSRF-Token");
      if(csrf_token === "Fetch") {
      var content = $.request.body.asString();
      var args = $.parseJSON(content);
  
      var xsName= args.name;
      var xsemail= args.email;
      var xsLoc= args.loc;
     //then execute DML statement  by passing these 3 parameters as arguments.
      catch (error) {
              $.response.setBody(content);   
              $.response.status = $.net.http.INTERNAL_SERVER_ERROR;   
      }
  </code></pre>
  
  <p>I am not able to do the update and getting error Err 500 - Internal server Error.
  Any suggestions would be extremely helpful</p>