Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi can you please help me to remove this error.? i am getting error
Uncaught TypeError: Object #<Object> has no method 'webservicesCall'

i am using this example:
Auto-suggest Control[^]

i call like this

C#
new autosuggest("getStationDesc", stationList, null, function(index, control) {
               

                var stationCode = control.keywords[index].substring(0, 3);
                console.log(stationCode);
                this.webservicesCall(stationCode);// i call web service here and here i getting error Uncaught TypeError: Object #<Object> has no method 'webservicesCall' 
                });



here is web service method********


C#
webservicesCall : function(stationCode) {
            alert("hi");
            var _this = this;
            var pl = new SOAPClientParameters();
            var parameter1 = stationCode;
            pl.add("parameter1", parameter1);
            SOAPClient.invoke(App.settings.server, "getDepartureStationDashboard", pl, true, _this.DepartureStationDashboard_callBack);
        },
Posted
Comments
Sandeep Mewara 7-Oct-12 1:41am    
Is the 'webservicesCall' present in the same JavaDcript/HTML file?
ravi1989h 7-Oct-12 1:54am    
yes ..actually i am using backbone.so all function is in controller file.
ravi1989h 7-Oct-12 1:55am    
;(function() {

fg.pages.departure = fg.PageController.extend({
regions : {
mainRegion : '.departure',
},
template : {
regionTemplate : 'departure/departure'
},
events : {
'click .back_h' : 'goBack',
'click .go_home_h' : 'goToDashBoard',
//'blur #getStationDesc' : 'test',
'click .cleardata_h': 'clearStationField',
'click .cleardataAll_h': 'clearFilterField',
'click .menuoption_h':'getMenuoptions',

},
scrollAreas : {
expertAnswerImg : {
id : "departure_scroll", // id of the scroller you want to have (temp)
element : ".departure", // element that needs to be wrapped in the iScroll
footer : true,
footer_element : ".generic_css_footer", // does footer need to be handled
scrollable : true,
adjust : -10 // does div needs to have iScroll (Default: true)
}
},
init : function() {
_.bindAll(this, "webservicesCall", "DepartureStationDashboard_callBack");
/*var LS_last_searched_station = window.localStorage.getItem('LS_last_searched_station');
if (LS_last_searched_station != null) {
this.webservicesCall(LS_last_searched_station);
}*/
this.webservicesCall("pdw");
},
DepartureStationDashboard_callBack : function(r) {
console.log(r);
App.collections.departure = new fg.collections.departure;
App.views.departure = new fg.views.departure;
this.region('mainRegion').show(App.views.departure);
if (r.length == 0) {
App.collections.departure.reset([{
empty_feed : true
}]);
} else {
App.collections.departure.reset(r);
}

},
goBack : function() {

history.back();
},
goToDashBoard : function() {
history.back();
},
linkElements : function() {

var stationList = new Array;
var r = JSON.parse(window.localStorage.getItem("stations")) || [];
for (var i = 0; i < r.length - 1; i++) {
stationList[i] = r[i].stationCode + " - " + r[i].stationName;
}

new autosuggest("getStationDesc", stationList, null, function(index, control) {
//alert("Selected key: \"" + control.keywords[index] + "\" with value: \"" +index+ "\"");

var stationCode = control.keywords[index].substring(0, 3);
console.log(stationCode);
this.webservicesCall(stationCode);
});

/*var obj = actb(document.getElementById('getStationDesc'), stationList);
var obj = actb(document.getElementById('getfilter'), stationList);

obj.actb_timeOut = -1;
obj.actb_lim = 10;
obj.actb_firstText = true;
obj.actb_mouse = true;
obj.actb_delimiter = new Array(' ', ',');
obj.actb_startcheck = 1;

obj.actb_bgColor = '#dbe3ec';
obj.actb_textColor = '#00256a';
obj.actb_hColor = '#dbe3ec';
obj.actb_fFamily = 'arial';
obj.actb_fSize = '16px';
obj.actb_hStyle = 'text-decoration:underline;font-weight="bold;";text-align="left"';*/

},
/*test : function(e) {
e.preventDefault();
console.log("oi");
if ($(e.target) == '') {

} else {

var stationCode = $(e.target).val().substring(0, 3);

window.localStorage.getItem('LS_last_searched_station', stationCode)
this.webservicesCall(stationCode)
}

},*/
webservicesCall : function(stationCode) {

var _this = this;
var pl = new SOAPClientParameters();
var parameter1 = stationCode;
pl.add("parameter1", parameter1);
SOAPClient.invoke(App.settings.server, "getDepartureStationDashboard", pl, true, _this.DepartureStationDashboard_callBack);
},
clearStationField :function(){
this.$el.find('.frm_txtfield_from_h').val('');
},
clearFilterField :function(){
this.$el.find('.frm_txtfield_all_h').val('');
},
getMenuoptions: function(){

$("#menu").slideToggle("slow");
},
});
})();
Mohibur Rashid 7-Oct-12 9:00am    
whome arexyou answering
ravi1989h 7-Oct-12 10:10am    
i got solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900