Hey guys,
I want to manage many pictures in different categories.
What i want to do:
Type in a inputbox the name of a category. Click on a search-button left of the inputbox.
Clicking on the button will send an ajax request to my server. In my PHP-script i find all database entires (pictures) linked to the category name. Then i want to print out all pictures in the format that the "Simple Photo Manager" requires.
This works great, my problem is that after the ajax request the "Simple Photo Manager" doesn't work anymore.
my HTML :
- <div class="demo ui-widget ui-helper-clearfix">
- <ul id="gallery" class="gallery ui-helper-reset ui-helper-clearfix">
- </ul>
- <div id="trash" class="ui-widget-content ui-state-default">
- <h4 class="ui-widget-header">zugehörige Benutzer</h4>
- </div>
- </div>
my jQuery :
- $('#create_check').click(function(){
- $('#create_loader').show()
- var myajaxrequest = $.post(
- 'myphpfile.php',
- { field: $('#Category').val() },
- function(data) {
- $('#gallery').append(data);
- })
- myajaxrequest.complete(function(){ $('#create_loader').hide() });
- });
For example, my PHP script will output:
- <li class="ui-widget-content ui-corner-tr">
- <?php echo $this->Html->image('Picture143.jpg',array('alt' => 'The peaks of High Tatras', 'width' => '96', 'height' => '72')); ?>
- <a href="images/high_tatras.jpg" title="View larger image" class="ui-icon ui-icon-zoomin">View larger</a>
- <a href="link/to/trash/script/when/we/have/js/off" title="Delete this image" class="ui-icon ui-icon-trash">Delete image</a>
- </li>
- <li class="ui-widget-content ui-corner-tr">
- <?php echo $this->Html->image('Picture153.jpg',array('alt' => 'The peaks of High Tatras', 'width' => '96', 'height' => '72')); ?>
- <a href="images/high_tatras.jpg" title="View larger image" class="ui-icon ui-icon-zoomin">View larger</a>
- <a href="link/to/trash/script/when/we/have/js/off" title="Delete this image" class="ui-icon ui-icon-trash">Delete image</a>
- </li>
I think i know what my problem is:
When i look at the page source before the ajax request and after the request, he's unchanged.
But the request works and i can see the new pictures.
Maybe "
$('#gallery').append(data);" is not the right function?
lg lucaaAUT
_____________
Sorry for my bad english :D