many many thanks Mike! now i have a basic idea and i will focus on it
trying to implement it in my plugin. Thanks again
What you have to do is actually *call* the callback function.
Now the way you've written the callback, it expects 'this' to be the element
you're working on - the same element which is 'this' in the click handler
itself. So you can't use an ordinary function call, you have to use .call()
or .apply
i know that load accepts a callback, but i want to understand how to
write a function that accepts a callback function 'cause i want to use
it in a plugin. I'm new to plugin development so this are my first
steps in understanding this concepts.
ok, so i tried a simple script just to understand ho
I don't know how you should prepare the data. That was just example code.
Are you using $(selector).load(...)? You know that already has an optional
callback function:
http://docs.jquery.com/Ajax/load#urldatacallback
Inside the callback, 'this' is the element you loaded the HTML text into, so
yo
hmm...so..how should i "prepare" the data?
something like this?
var someData = $(selector).load("page.php",{...etc});
in this way the callback function will have access to the loaded
content as jquery wrapped set of elements?
Simply declare the callback as one of the parameters to your function, and
call it when you're ready.
Let's take a non-jQuery example for simplicity.
// Call a callback function after a random delay of 1 to 5 seconds,
// and pass the time delay we used as an argument to the callback
f
6 matches
Mail list logo