jquery ajax post options to node.js request options

I use jQuery's ajax method in my node.js code. I would like to convert my jQuery ajax function's passed options to node's http module's request method options since now I want to use the request method instead. Is there a better way to do that than this ?

    function checkSetOption(param){
    if(param === undefined){
        return false;
    }else{
        return true;    
    }

} // End checkSetOption
//
var ajax = function(params,callBack){

    request_options = {};

    // Parse for http request params
    params = new Array('dataType','url','method','success');
    params.forEach(function(option,index,array){
        if(checkSetOption(option)){

            request_options.option = params.option;
        }
    }); // End 'forEach' method



    http.request(param);
};

If I get your question correctly you want to call jquery ajax to a URL from node.js. Then you cannot use http.request method for this. AJAX uses XMLHttpRequest and http.request as the name says is that. Both are different, so you may not be able to convert it.

Use XMLHttpRequest package in node for this. The jquery module uses XMLHttpRequest to call AJAX.

See this link