Make a query with Jquery for a REST service
Hi,
i a'm a newbie of JQuery. I'm using it for query a REST service. My problem is that i cannot create the correct address to query.
My rest service is available at this address:
http://10.10.10.10:8080/restService/parameters
My code is something like that:
-
function searchUserAttributes(userName, callbackfunction){
var searchUrl = '/restService/'
$.ajax({
type: "GET",
url: searchUrl,
data: ({parameter1: 'pinco', parameter2: userName}),
dataType: "xml",
error: function(){
alert('Error loading XML document');
},
beforeSend: function(XMLHttpRequest)
{
resetResultShowLoading()
},
success: function(xml) {
$("#update-target").html(constructAndDisplayQueryResult(xml))
}
});
}
The link generated for query is this:
http://10.10.10.10/restService/parameters
The port of host is absent.
If i modify the variable
searchUrl adding the port the the url generated from Jquery is totally different from the one above:
http://10.10.10.10/url_of_page_where_i_made_the_call/restService/parameters
So my questions are:
- how Jquery generate the entire address to query?
- how i can specify the port of the host?
Thanks in advance for help, and please excuse me for my poor English.