You will have to use native AJAX or JQuery's $.ajax() method.
This[
^] is a useful article to get started with jQuery's $.ajax() method.
And
This[
^] article is about using pagemethod with a ScriptManager.
BTW, if you just want to use your JavaScript variable in the code behind, you can also store it into hidden field and access it.