Passing Argument to Web Service

How can i pass parameter to Restfull web service using XMLHttpRequest in javascript.

I have the following web service method:

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public String getJson(String countryKey) {
        System.out.println("Inside getJson()");
        System.out.println("countryKey = " + countryKey);
        
        return "countryKey = " + countryKey;
    }

and I’m trying to call this method from javascript as follow:

function populateDistrictList() {
                var element = document.getElementById("selectCountry");
                var selectedCountryKey = element.value;
                var selectedCountry = element.options[element.selectedIndex].text;
                alert(selectedCountryKey + " - " + selectedCountry);
                var xmlHttp = new XMLHttpRequest();

                var url = "http://localhost:8080/MissionWS/webresources/generic?
               selectedCountryKey="+selectedCountryKey;
                alert("url = " + url);
                //xmlHttp.open('GET', url, true);
                xmlHttp.open('GET', url, true);
                xmlHttp.responseType = 'json';


                if (xmlHttp) {
                    xmlHttp.onreadystatechange = function () {
                        if (xmlHttp.readyState == 4) {
                            if (xmlHttp.status == 200) {
                                var text = xmlHttp.responseText;
                                alert(text);
                            } else {
                                alert("Something is wrong !");
                            }
                        }
                    };
                    xmlHttp.send();
                }
            }

I get an empty string
Can someone help ???

If you manually construct the URL (aka hardcode the argument), does the correct value get returned?