What is wrong with this function:
function() {
$.get('/controller/action', function(data) {
$('#temporaryPhotos').text(data);
} );
return false;
}
What you need to do is extract the HTML file from the page / controller / action and paste the HTML code into the div #temporaryPhotoson the current page.
The initial markup is as follows:
<div id="temporaryPhotos"></div>
So this is just an empty div. The jQuery function should fill it with photos of another page (this, of course, is the same site). But the div remains empty.
EDIT:
I think that I am not very good at my message, therefore additional information is provided here. What I'm actually trying to accomplish is to use the above function as a callback for the Uploadify jquery plugin ( http://www.uploadify.com ).
Here is the full javascript code:
$(document).ready(function() {
$('#photo').uploadify({
'uploader' : '/flash-uploader/scripts/uploadify.swf',
'script' : '/flash-uploader/scripts/upload-public-photo.php',
'cancelImg' : '/flash-uploader/cancel.png',
'scriptData' : {'user_id' : 'USER_ID'},
'queueID' : 'fileQueue',
'auto' : true,
'multi' : true,
'sizeLimit' : 2097152,
'fileExt' : '*.jpg;*.jpeg;*.gif;*.png',
'wmode' : 'transparent',
'onComplete' : function() {
$.get('/controller/action', function(data) {
alert(data);
$('#temporaryPhotos').html(data);
} );
return true;
}
});
});
I tried both text () and html (), also alert (). Nothing yet: (
EDIT2:
, onComplete() Uploadify :
jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) {
if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed');
jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()});
}
});
( ), .
EDIT3:
:
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/flash-uploader/scripts/swfobject.js"></script>
<script type="text/javascript" src="/flash-uploader/scripts/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#photo').uploadify({
'uploader' : '/flash-uploader/scripts/uploadify.swf',
'script' : '/flash-uploader/scripts/upload-public-photo.php',
'cancelImg' : '/flash-uploader/cancel.png',
'scriptData' : {'user_id' : 1},
'queueID' : 'fileQueue',
'auto' : true,
'multi' : true,
'sizeLimit' : 2097152,
'fileExt' : '*.jpg;*.jpeg;*.gif;*.png',
'wmode' : 'transparent',
'onComplete' : function() {
alert("hello");
}
});
});
</script><script type="text/javascript" src="/js/document-ready.js"></script>