jquery-callback

Reference to an object from a callback function in jQuery.

I have following situation. In a constructor of a pseudo class I attach a click event to an element. When the event is triggered I would like to refer from the callback function to the object where the event was set. Code of the pseudo class constructor function MyClass(){ this.myClassAttribute = "A class attribute"; // here `this...

jQuery Plugin: Using callback to alter plugin behavior

I am using the jQuery token input plugin and would like change its behavior when a token is added. I added an "onAddToken" callback to the original code so I can see when a token is added to the input box, but I'm not sure how to alter tokenInput's URL from "url/to/call" to a new URL, "new/url/to/call". this, $this, and $(this) do n...

jQuery callback called too early?

Here's the code I'm using: function load(toLoad, area){ $(area).html('<img src="images/ajax-loader.gif" alt="Loading" class="center" />'); loadContent(); function loadContent() { $(area).load(toLoad,'',sorter()) }; function sorter() { alert('s'); $("#myTable").tablesorter({ widgets: ['zebra'] ...

Problem with RaiseCallbackEvent in modal popup

I have a popup opened using NyroModal plugin to logout of the application. In the Popup when the button is clicked RaiseCallbackEvent event in the codebehind in popup is not executed. PopUp Code: <script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script src="../Scripts/jquery.nyroModal-1.5.5.js" type="text/javas...

jQuery HOW TO?? pass additional parameters to success callback for $.ajax call ?

Hello jQuery Ninjas! I am trying, in vain it seems, to be able to pass additional parameters back to the success callback method that I have created for a successful ajax call. A little background. I have a page with a number of dynamically created textbox / selectbox pairs. Each pair having a dynamically assigned unique name such as...

If a jQuery function calls itself in its completion callback, is that a recursive danger to the stack?

Hi, I'm writing a little jQuery component that animates in response to button presses and also should go automatically as well. I was just wondering if this function recursive or not, I can't quite work it out. function animate_next_internal() { $('#sc_thumbnails').animate( { top: '-=106' }, 500, function() { an...

Using TextboxList events and callbacks

Has anyone gotten callbacks working with Guillermo Rauch's TextboxList Autocomplete? I've tried multiple ways to bind and multiple events (e.g. hover) - nothing seems to register. $('#entSearch').textboxlist({unique: true, plugins: { autocomplete: { minLength: 3, queryRemote: true, ...

Programming a callback function within a jQuery plugin

I'm writing a jQuery plug-in so I can reuse this code in many places as it is a very well used piece of code, the code itself adds a new line to a table which has been cloned from a hidden row, it continues to perform a load of manipulations on the new row. I'm currently referencing it like this: $(".abc .grid").grid(); But I want to...

jQuery Cycle slide count

Im currently using a plugin called Cycle for jQuery and would like to tweak a small piece of functionality but don't really know how. I made an example which can be viewed here on jsbin. The issue that I am having is with the actual slide "counter." The way that its currently configured, the current slide that it is on does not updat...

jQuery get source element in callback

$('.myElem').live('click', function() { $(this).hide(500, function() { $(this).siblings('.myOtherElem').show(); }); }); The above doesn't work because $(this) is no longer in correct scope in the callback. How do I pass my original source element into the callback? ...

Incomplete Execution of Callbacks on jQuery POST

I have 2 js methods which do an AJAX post to the server and display results accordingly. 1) Delete - Delete upon callback 'hides' the deleted element and does not the refresh the page function DeleteRule(ruleId) { var deleteRuleAction = $('#delete-rule-action').val(); $.post(deleteRuleAction, { ruleId: ruleId }, function(dat...

How to execute jQuery callback before data?

I have a simple post, which executed the data returned as a script as such: $.post("/home", { foo: 'bar' }, function(){ //callback function }, "script"); Here's what happens: The request gets sent A piece of JS code is returned as a response and executed The callback is executed I need the callback to be executed before the re...

jquery: howto return caller-id when using wildcard selectors

i'm using jquery to invoke JSON-requests and they're triggered form a bunch of autocomplete-fields. I use wildcard-selector and now need to find out which ac-field that fired the event. ... $( "[id*='_lookupCmb']" ).autocomplete({ source: function( request, response ) { $.ajax({ ... ... select: function( event, u...

anonymous callback function in .animate() not working

I can't for the life of me figure out what the problem with this code is. The animation itself works fine: if (!list.is(':animated')) { list.animate( {"top": "+="+item_size}, {queue:false, duration:speed}, function() { alert(); } ); // end of animate function } //end of if statement ...

jQuery callback on img src replacement?

What I am trying to do is to change an image on my webpage when the user mouses over a thumbnail of it. It is easy for me to do it this was because the thumbnail src only has 'tn_' appended to the filename and is otherwise identical. The problem I'm having is that when I switch the src on the image the attr function returns the img dom ...

JQuery fadeto animation with callback problem

Hello guys! Here's my code: function hideColumnAndShowOther(columnToHide, columnToShow) { $(columnToHide).fadeTo("slow", 0.0, function() { $(columnToShow).fadeIn("slow"); }); } In this case the callback function isn't called. I have used the firebug tool to get the root of the problem. In...