Dear all,
i do have a requirement that to call a webservice method from javascript.
i have written the code as follows.
in .asmx page
[webmethod]
public list<substation> GetsubstationsData()
{
return bcommon.GetSubstationdetails();
}
....
and in aspx page
<select data-bind="options:substationvalues,optionText:'substationname',optionvalue:'substationid',value:selectedsubstationid,optionscaption:'select substation'"/>
in js file
function substationentity(data)
{
var self=this;
self.substationname=ko.observable(data.substationname);
self.substationid=ko.observable(data.substationid);
}
function datamodel()
{
var self=this;
self.substationvalues=ko.observablearray([]);
self.selectedsubstationid=ko.observable("");
fetchsubstationsdata=function(){
$.ajax({
type:'Get',
dataType:'json',
url:'service1.asmx/GetsubstationsData',
success:function(data){
//my binding code;
}
}
});
}
}
and also i want to call addmethod in webservice also, for that should i use type as 'post' in above ajax call....???, the above function is not working for me
it is showing requested url format is not supported...error, how can i achieve this...please help me to solve this.