One more method you can look by ajax call by mnaking xmlhttp object.
jsut like as
var baseUrl = "http://localhost:54976/RestServiceImpl.svc/";
function AjaxRequest(baseurl, type, callbackResponse, parameterString) {
this.BaseURL = baseurl;
this.Type = type;
this.Callback = callbackResponse;
this.createXmlRequestObject();
this.ParemeterString = parameterString;
}
AjaxRequest.prototype.createXmlRequestObject = function() {
if (window.ActiveXObject) {
try {
this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
this.xmlHttp = false;
}
}
else {
try {
this.xmlHttp = new XMLHttpRequest()
} catch (f) {
this.xmlHttp = false;
}
}
if (!this.xmlHttp) {
alert('there was an error creating the xmlhttp object');
} else {
}
}
AjaxRequest.prototype.MakeRequest = function() {
try {
if (this.xmlHttp.readyState === 4 || this.xmlHttp.readyState === 0) {
this.xmlHttp.open(this.Type, this.BaseURL, false);
var that = this;
this.xmlHttp.onreadystatechange = function() {
try {
alert(that.xmlHttp.readyState);
if (that.xmlHttp.readyState == 4) {
alert(that.xmlHttp.status);
if (that.xmlHttp.status == 200) {
var xmldoc;
if (window.ActiveXObject) {
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = "false";
that.Callback(that.xmlHttp.responseText);
}
else {
that.Callback(that.xmlHttp.responseText);
}
}
}
}
catch (e)
{ alert(e) }
}
switch (this.Type) {
case "GET":
this.xmlHttp.send(this.BaseURL);
break;
case "POST":
this.xmlHttp.setRequestHeader("Content-type", "application/json");
this.xmlHttp.send(this.ParemeterString)
}
}
else {
setTimeout('GetAllAppsService', 5000);
}
} catch (e) {
alert(e);
}
}
what you need to call ur wcf service by making object of AjaxRequest.
Let me know , If it will help you or any query regarding this.