I have a question, I'm using uploadify, and every time when a file finishes to upload, the script runs a code which is located in the onComplete
statement, and the code from the onComplete
statement it's an ajax call to a page, let's call it X , how can I know when the script access the page X for the first time?
views:
147answers:
2
+1
A:
Although I'm not familiar with uploadify, if you set a variable in the global scope (outside the onComplete), I'll call it var hasBeenCalled, set it to false at the page load. When onComplete is called, do:
if (hasBeenCalled)
{
// not the first time
}
else
{
//first time
hasBeenCalled = true;
}
Hope it helps
Ryan
2009-08-19 16:59:30
doesn't work.. :(
Uffo
2009-08-19 17:31:33
A:
try with this:
var myFirstEvent = false;
var myFunOnComplete = function()
{
if (!myFirstEvent)
{
// code for fist instance
}
// set finish the first instance
myFirstEvent = true;
// code for ajax call
callAjax();
}
jQuery('#fInput').uploadify({
...
'onComplete': myFunOnComplete,
...
});
andres descalzo
2009-08-19 21:00:39