If your js is in a template, you can use {vb:raw bbuserinfo.securitytoken} to get the value of the security token. You'd add a parameter to your request called "securitytoken" and set it to that value. If you were using an html form, you'd add
Code:
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
but if you're doing it all in js it would be different of course.
Another way to do it is to add some js to the page to set a variable which you can use later. For example, the vb headinclude template includes this:
Code:
<script type="text/javascript">
<--
...
var SECURITYTOKEN = "{vb:raw bbuserinfo.securitytoken}";
...
// -->
</script>
If you're already using the vb headinclude template on your page, you can just use the SECURITYTOKEN variable in your js.