Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2823

Re: URL parameters or request Body- XSJS

$
0
0

GET will read the data. you can use POST for sending it. see the below snippet:

 

var token = XMLHttpRequest.getResponseHeader('X-CSRF-Token');

  $.ajax({

  url: <target_url>,

  type: "POST",

  beforeSend: function(xhr) 

                    {     

                              xhr.setRequestHeader("X-CSRF-Token", token); 

                    }, 

  processData :false,

  contentType: false,

  POST_DATA:data,

  success:function(){

  alert("sucess in post");

  },

  error:function(){

  alert("fail");

  }

  })


here, "data" would be anything that you have read, maybe a JSON being read from a GET.


so, initially you would read the data from a source URL and get it in say JSON format and then using POST, you can send it to the target URL.


Hope this helps!


Viewing all articles
Browse latest Browse all 2823


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>