callback

Global callback for Ajax calls in JQuery

Is it possible to create and attach a callback which would get called whenever an ajax request completes regardless of whether the call was made using $.ajax, $.post, load or any other function? EDIT: The solution given by Nakul (using ajaxSuccess global event) is almost perfect. However I have a problem when using this with the load f...

implementing a simple prepared query in PHP

I'm trying to create a very simple database abstraction, one part of it using prepared queries. Now, I have a function take a query string and an array of values like this: $query = "SELECT `first_name`, `last_name` FROM ::table_name WHERE `id` = :id" $values = array( 'table_name' = $this->table_name, 'id' = $user_id, ); this...

JQuery ajax callback function

Hello, I'm very new to JQuery and I try to fill my html select boxes with Jquery but they stay empty. Below is my code: $('select').each(function(){ var action = 'SELECT_FLDS_GRID'; var fldnam = $(this).attr('name'); $.getJSON('frm.grid.php',{'action':action,'fldnam':fldnam},function(j){ var_SelectOption(j...

options inheritance

Hi there. I have a plugin module that extends the AR with a before_save callback to log all changes made into a relating acts_as_commentable comment. This works fine. However, I want to add more details to the comment such as who made the change etc. I have made a couple of fields available to the model instance log_message and log_ow...

create a callback function instead of using a flag var to control when a specific function is done.

Hello everyone, I have a code snipet like this: var nbrPrevArt = $("#accordion > div .accordionPanel").size(); var processing = false; if (nbrPrevArt == 0) { processing = true; getArticlesPreview();//Fetches articles first } //loop that makes the browser to wait until finishes "getArticlesPreview()" while(!processing) { } ...

Javascript: Flash callback method produces error UNLESS alert() first?

Ok I have a flex app and I am adding a callback method like this: private function init():void { ExternalInterface.addCallback( "playVideo", playVideo ); } private function playVideo(videoSource:String):Boolean { videoDisplay.source = videoSource; return true; } I am calling it with javascript like this: function show...

ASP.NET callback not being fired in IE

We're using a control that uses Callbacks in our ASP.NET page. The control works fine in FireFox, Google Chrome, etc. The control works fine if we do not use ASP.NET AJAX History. As soon as we call this code, the callbacks stop working in IE (6, 7 and 8): ScriptManager.GetCurrent(Page).AddHistoryPoint("h", id); I did some server s...

In C++, is it safe/portable to use static member function pointer for C API callbacks?

In C++, is it safe/portable to use static member function pointer for C API callbacks? Is the ABI of a static member function the same as a C function? ...

ShareThis setting properties in callback don't work

I'm using the ShareThis widget. I need to change the url property after the object has been created so I'm using the callback function option. In the callback function, I attempt to change the url property but the email that goes out still contains the old value. Has anyone been able to solve this problem? If so, I would appreciate y...

Javascript: Closures and Callbacks

What are these two? I've yet to find a good explanation of either. ...

Android: callback for search widget opened and dismissed

I have a screen layout that is forced to be potrait mode. Because it is very complex I don't have the time right now to invest creating a separate one for landscape mode. It also doesn't make much sense for my type of application. However, for input fields it's better to provide a landscape mode, because some phones have a hardware keyb...

Are there any patterns used for communicating between browser windows in an ASP.Net web app?

First, some background... I have a mapping application in which a child window can open where there are links. When a link is clicked the child window needs to say "Hey map! such-and-such link was clicked now zoom to this location and mark it." I'm trying to think of a good clean way to accomplish this. Are there any patterns out ther...

Jquery: wait for callback before returning

Hello, I have a javascript function which asks for some ajax data and gets back a JSON object. Then it should return the object. The problem is that I don't know how to make the function return from the Ajax callback. Of course myFunction: function() { $.get(myUrl, function(data) { return data; }); } does not work, be...

Calling a Method from Within a Ruby Class? (or is this rails magic)

I'm new to Ruby and working through some tutorials/screencasts. I've reached the section where they're discusisng the before_filter callback, and it's using some syntax that's a little weird for me. I don't know if it's a feature of ruby, of if it's some rails magic, and was hoping someone here could set me straight or point me in the ...

Can I pass an object's instance method to a method expecting a callback in Scala?

Let's say I have a method expecting another method as a parameter. Is it possible to send an object's instance methods for that parameter? How would I handle methods that have no parameters? I'll write some pseudocode: void myMethod1(callback<void,int> otherFunc); // imagine a function returning void, and taking a int parameter void m...

Calling a WCF service contract from inside a callback implementation

Hi, I 'm having a problem with WCF callbacks that's a proper head-scratcher... Description of setup: There's an interface IService that defines a WCF service. My server app implements that service in class ServiceImplementation. The service also has a callback, defined in IServiceCallback and implemented in the client app in class Call...

how to pass a non static-member function as a callback?

io_iterator_t enumerator; kern_return_t result; result = IOServiceAddMatchingNotification( mNotifyPort, kIOMatchedNotification, IOServiceMatching( "IOFireWireLocalNode" ), serviceMatchingCallback, (void *)0x1234, & enumerator ); serviceMatchingCallback((...

(How) is it possible to bind/rebind a method to work with a delegate of a different signature?

I'm a c++ developer having used signals & slots in c++ which to me seems to be analogous to delegates in c#. I've found myself at a loss in searching for the functionality provided by "bind", and feel I must be missing something. I feel like that something like the following, which is possible in c++ should be possible in c# with delega...

Redmine Plugins - Detecting enabling and disabling of modules

I'm working with an external framework (redmine) which has one Project model that has_many EnabledModules. Projects can have EnabledModules "attached" or "removed" via the module names, like this: class Project < ActiveRecord::Base ... has_many :enabled_modules, :dependent => :delete_all ... def enabled_module_names=(module_nam...

GM_xmlhttpRequest - triggers on Parent and Iframe windows - should only trigger on Parent window

I am building a GreaseMonkey test script that makes a GM_xmlhttpRequest each time a specific site is visited. GM_xmlhttpRequest should only trigger on the first "document" found (the parent window) and it should ignore iframes and other child windows (I don't want the url for the iframes). Some thoughts and possible solutions: 1) I tri...