PDA

View Full Version : ajax method



[WP]joju
Feb 05, 2009, 8:31 AM
question: you can call a coolite ajaxmethod inside any javascript function right? whenever i do "Coolite.AjaxMethods.serverFunction()" i am getting a javascript error saying object does not support property or method, please help

Vladimir
Feb 05, 2009, 8:36 AM
Hi,

When define this function? Also what rendered to the page? Can you post Coolite script block which rendered to the page
 

[WP]joju
Feb 05, 2009, 8:46 AM
ok, im creating a dynamic window using this javascript code, then inside that window is a toolbar with a button which calls a function that has an ajax method inside it.. of course in the server side code i got a public non-static function "check()" with an [AjaxMethod] attribute




var win;
win = Ext.getCmp('extwin_' + dv.getRecord(node).get('id'));
if(!win)
{
var toolbar = [{
tooltip:{title:'Unpublish', text:'Unpublish the selected question(s)'},
text: '',
iconCls:'icon-check',
handler: checkSelection ,
scope:this
}]

win = new Ext.Window({renderTo: Ext.getBody .............

}


var checkSelection = function()
{
Coolite.AjaxMethods.check();
}




can this be done with this button? because in the examples, the ajax method was triggered by a coolite control

Vladimir
Feb 05, 2009, 9:03 AM
Hi,

I mean where define ajax method: in page, in master page or in user control? May be it is id's issue (because if ajax method define in master page or in user control then need to add client id to the calling or use AjaxMethodProxyID attribute - see http://forums.ext.net/showthread.php?1372


Also it can be a cache issue - several days ago we added ignore ajax method cache under debug. You can update from SVN and retest or restart your web server to clear cache (IIS or local web development server)


Can you investigate**generated *Coolite script block or post it for investigate? Does the proxy for this function is presented in this block

[WP]joju
Feb 06, 2009, 6:43 AM
i got it working now by appending the ID of the user control to the client side call "Coolite.AjaxMethods.check();" to "Coolite.AjaxMethods.ucID.check();" . i did not make use of the AjaxMethodProxyID attribute but it is still working by just using the ID and not the client ID as mentioned. i don't know if it got something to do with that the javascript call to the AjaxMethod is in the same user control that contains the server side AjaxMethod. but thanks again for the reference