Reputation: 3223
hi i have this ajax function
mainUrl = "http://someURL/POSMobileConnector/";
parameter = "Event Materials";
servEntity = "Product/"
console.log("test");
$.ajax({
url: mainUrl + servEntity + 'loaditembycategory/',
type: "GET",
data: parameter ,
dataType:'json',
contentType: "application/json; charset=utf-8",
ProcessData:false,
//username:"admin",
//password:"admin",
//beforeSend : function(xhr) {
// xhr.setRequestHeader("Authorization", cred/*"Basic " + encodeBase64(credentials)*/);
//},
success: function (msg) {//On Successfull service call
ServiceSucceeded(msg);
},
error: function(error){
console.log(error);
}
});
My Question is when i look at firebug. the url result is http://url/service/Product/loaditembycategory/?Event%20Materials. Now i want to remove the "?" part because the right url is to be http://url/service/Product/Event%20Materials only.
Upvotes: 0
Views: 92
Reputation: 11524
$.ajax({
//...
url: mainUrl + servEntity + 'loaditembycategory/' + encodeURIComponent(Param)
//...
});
Upvotes: 1
Reputation: 364
url: mainUrl + servEntity + 'loaditembycategory/' + Param,
type: "GET",
Upvotes: 1
Reputation: 6771
Then add it to the URL
url: mainUrl + servEntity + 'loaditembycategory/' + Param,
The data param is for GET or POST params only.
Upvotes: 1
Reputation: 887767
The data:
parameter is put in the query string.
It sounds like you don't want a query string, so you shouldn't use the data:
parameter at all.
Instead, concatenate the URL string directly.
Upvotes: 3